Springboot项目整合Swagger2报错


SpringBoot2.2.6整合swagger2.2.2版本的问题,启动SpringBoot报如下错:

 1 Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.  2 12:32:32.689 [main] ERROR o.s.b.d.LoggingFailureAnalysisReporter
3 *************************** 4 APPLICATION FAILED TO START 5 ***************************
6 Description:
7 Parameter 0 of method linkDiscoverers in org.springframework.hateoas.config.HateoasConfiguration required a single bean, but 15 were found: 8 - modelBuilderPluginRegistry: defined in null 9 - modelPropertyBuilderPluginRegistry: defined in null 10 - typeNameProviderPluginRegistry: defined in null 11 - documentationPluginRegistry: defined in null 12 - apiListingBuilderPluginRegistry: defined in null 13 - operationBuilderPluginRegistry: defined in null 14 - parameterBuilderPluginRegistry: defined in null 15 - expandedParameterBuilderPluginRegistry: defined in null 16 - resourceGroupingStrategyRegistry: defined in null 17 - operationModelsProviderPluginRegistry: defined in null 18 - defaultsProviderPluginRegistry: defined in null 19 - pathDecoratorRegistry: defined in null 20 - relProviderPluginRegistry: defined by method 'relProviderPluginRegistry' in class path resource [org/springframework/hateoas/config/HateoasConfiguration.class] 21 - linkDiscovererRegistry: defined in null 22 - entityLinksPluginRegistry: defined by method 'entityLinksPluginRegistry' in class path resource [org/springframework/hateoas/config/WebMvcEntityLinksConfiguration.class] 23

  Action:
24 Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed 25 Process finished with exit code 1

解决办法:swagger2版本改为swagger2.9.2

<dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.9.2</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>2.9.2</version> </dependency>

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM