java - springfox.documentation.builders.RequestHandlerSelectors.withClassAnnotation
问题描述
我把spring swagger版本升级到3.0.0,但是启动项目显示这个错误:
2021-06-24 11:50:18.923 INFO 1 --- [ main] o.e.jetty.server.handler.ContextHandler : Stopped o.s.b.w.e.j.JettyEmbeddedWebAppContext@2a666c8e{application,/,[file:///tmp/jetty-docbase.3371038441115428463.11004/, jar:file:/root/soa-room-service-1.0.0-SNAPSHOT.jar!/BOOT-INF/lib/springfox-swagger-ui-2.7.0.jar!/META-INF/resources],UNAVAILABLE}
2021-06-24 11:50:18.957 INFO 1 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-06-24 11:50:18.966 ERROR 1 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
com.sportswin.soa.misc.config.swagger.SwaggerConfig.createRestApi(SwaggerConfig.java:86)
The following method did not exist:
springfox.documentation.builders.RequestHandlerSelectors.withClassAnnotation(Ljava/lang/Class;)Lcom/google/common/base/Predicate;
The method's class, springfox.documentation.builders.RequestHandlerSelectors, is available from the following locations:
jar:file:/root/soa-room-service-1.0.0-SNAPSHOT.jar!/BOOT-INF/lib/springfox-core-3.0.0.jar!/springfox/documentation/builders/RequestHandlerSelectors.class
It was loaded from the following location:
jar:file:/root/soa-room-service-1.0.0-SNAPSHOT.jar!/BOOT-INF/lib/springfox-core-3.0.0.jar!/
我的春季启动版本是:2.1.12.RELEASE
。春云版:Greenwich.SR1
. 我应该怎么做才能解决这个问题?似乎没有人遇到这个问题。这是我的配置:
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'io.springfox' && details.requested.name == 'springfox-swagger2') {
details.useVersion "3.0.0"
}
}
}
解决方案
推荐阅读
- java - 使用流拆分字符串并返回具有相同单词顺序的字符串
- javascript - 在javascript中调用提升函数时的奇怪效果
- ios - 除了 UITableView/UICollectionView RxCocoa 绑定之外,如何使用 SkeletonView
- amazon-web-services - CloudFormation 使用 FindInMap 连接字符串列表
- sql - 以表2的行数据为列标题合并两张表
- javascript - 如何在 5 秒后将“display:none”设置为我之前在 JavaScript 中设置“display:initial”的 div?
- php - PHP 后端有时会返回带有 HTML 的状态码 500,我的反应前端如何处理这个?
- xml - AWK 从 XML 元素中获取属性值
- docker - 可以从容器中的不同 docker 映像访问文件吗?
- javascript - React Native - 组件未加载