博客列表 >Springboot项目整合Swagger2报错

Springboot项目整合Swagger2报错

千夜大魔王
千夜大魔王原创
2020年04月17日 12:49:101098浏览

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

  1. <dependency>
  2. <groupId>io.springfox</groupId>
  3. <artifactId>springfox-swagger2</artifactId>
  4. <version>2.9.2</version>
  5. </dependency>
  6. <dependency>
  7. <groupId>io.springfox</groupId>
  8. <artifactId>springfox-swagger-ui</artifactId>
  9. <version>2.9.2</version>
  10. </dependency>
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议