问题
I am trying to use the swagger-ui for the rest services. I have a swaggerconfig class as follows.
@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();
}
}
Its throws me an error on this line
.paths(PathSelectors.regex("\\.*"))
Which says
The type com.google.common.base.Predicate cannot be resolved. It is indirectly referenced from required .class files
My question is: Isn't this lib included in the swagger base package. Also, none of the examples point towards adding it explicitly.
回答1:
Me too! Guava could be included by Swagger.
I solved removing com.google.guava
from my .m2
folder, following a mvn clean & mvn install
.
Likely in my local repo, guava jar was corrupted.
来源:https://stackoverflow.com/questions/46581571/springfox-swagger-whitelabel-error-page-com-google-common-base-predicate-cann