Spring boot 2.1版本:Consider renaming one of the beans or enabling overriding by setting

今天搭建一个zuul,启动的时候报错,报错信息如下:

Description:

The bean 'counterFactory', defined in class path resource [org/springframework/cloud/netflix/zuul/ZuulServerAutoConfiguration$ZuulCounterFactoryConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/cloud/netflix/zuul/ZuulServerAutoConfiguration$ZuulMetricsConfiguration.class] and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true

于是到网上查了一下,说是有相同名字的类导致冲突。

看报错信息提示,也是说需要设置 spring.main.allow-bean-definition-overriding=true

于是乎在applcation.properties中增加 spring.main.allow-bean-definition-overriding=true

 

结果报了另一个错:

It was loaded from the following location:

    file:/C:/Users/Administrator/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.1.6.RELEASE/spring-boot-autoconfigure-2.1.6.RELEASE.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.springframework.boot.autoconfigure.web.ServerProperties$Servlet

 

后面继续在网上看,有人说是因为springboot改到了2.1.0版本,导致版本冲突,后来我把spring boot版本降为1.5,但是还是报其他错,但是改为2.0的版本就可以了:


	org.springframework.boot
	spring-boot-starter-parent
	2.0.0.RELEASE
	 

 

你可能感兴趣的:(spring,boot)