我正在尝试使用 swagger-ui 来实现其余服务。我有一个 swaggerconfig 类,如下所示。
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket api(){
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.paths(PathSelectors.regex("\\.*"))
.build();
}
@SuppressWarnings("deprecation")
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("Spring REST Sample with Swagger")
.description("Spring REST Sample with Swagger")
.termsOfServiceUrl(Open")
.contact("Niklas Heidloff")
.license("Apache License Version 2.0")
.licenseUrl("https://github.com/LICENSE")
.version("2.0")
.build();
}
}
它在这一行上给我一个错误
.paths(PathSelectors.regex("\\.*"))
这说的是
The type com.google.common.base.Predicate cannot be resolved. It is indirectly referenced from required .class files
我的问题是:这个库不是包含在 swagger 基础包中吗?此外,没有一个示例指向显式添加它。
最佳答案
我也是! Guava 可以被 Swagger 包含。
按照mvn clean & mvn install
,我解决了从 .m2
文件夹中删除 com.google.guava
的问题。
可能在我的本地存储库中, Guava jar 已损坏。
关于java - Springfox Swagger 'Whitelabel Error Page' :com. google.common.base.Predicate 无法解析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46581571/