SpringBoot与Swagger整合Error starting ApplicationContext. To display the conditions report re-run your

在进行SpringBoot与Swagger整合配置过程中,出现了以下错误:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-12-10 15:14:16.587 ERROR 6536 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of method linkDiscoverers in org.springframework.hateoas.config.HateoasConfiguration required a single bean, but 15 were found:
	- modelBuilderPluginRegistry: defined in null
	- modelPropertyBuilderPluginRegistry: defined in null
	- typeNameProviderPluginRegistry: defined in null
	- documentationPluginRegistry: defined in null
	- apiListingBuilderPluginRegistry: defined in null
	- operationBuilderPluginRegistry: defined in null
	- parameterBuilderPluginRegistry: defined in null
	- expandedParameterBuilderPluginRegistry: defined in null
	- resourceGroupingStrategyRegistry: defined in null
	- operationModelsProviderPluginRegistry: defined in null
	- defaultsProviderPluginRegistry: defined in null
	- pathDecoratorRegistry: defined in null
	- relProviderPluginRegistry: defined by method 'relProviderPluginRegistry' in class path resource [org/springframework/hateoas/config/HateoasConfiguration.class]
	- linkDiscovererRegistry: defined in null
	- entityLinksPluginRegistry: defined by method 'entityLinksPluginRegistry' in class path resource [org/springframework/hateoas/config/WebMvcEntityLinksConfiguration.class]


Action:

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


Process finished with exit code 1

经过分析查看,终于发现是SpringBoot与Swagger的版本要注意,两者的版本,springboot项目的版本低,相应的swagger版本不能太高,反之亦然,避免项目报错,我的springboot版本为2.4.0,swagger版本为2.2.2,项目启动就会报如下错误:(这个问题的解决办法就是直接将pom文件中的swagger版本换成2.9.2就可以了)

猜你喜欢

转载自blog.csdn.net/weixin_45457983/article/details/110953815
今日推荐