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>

 

posted @ 2020-04-17 12:58  千夜大魔王  阅读(3219)  评论(0编辑  收藏  举报