Description: The bean 'proxyRequestHelper', defined in class path resource [org/springframework/clo

配置zuul网关,启动springboot报错

Description:

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

Action:

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

情况一:方法名/bean和类名重复,这种情况一般不会出现,很少

情况二:springboot和springcloud版本不一致,多数是这种情况

解决办法:

一:修改bean或者类名,或者设置spring.main.allow-bean-definition-overriding=true

二:更换版本,保持springboot对应的springcloud版本,倒过来匹配也行

本人出现的情况是spring boot用的是2.1.1.RELEASE使用的springcloud版本是Finchley.RELEASE,实际springboot 2.1.1.RELEASE对应的springcloud版本应该是Greenwich.RELEASE

正确的对应版本依赖:

<dependency>
				<groupId>org.springframework.cloud</groupId>
				<artifactId>spring-cloud-dependencies</artifactId>
				<version>Greenwich.RELEASE</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
			<dependency>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-dependencies</artifactId>
				<version>2.1.1.RELEASE</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>

 


版权声明:本文为ypp91zr原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。