背景:构建springcloud微服务过程中,通过Zuul的微服务网关,实现身份认证,动态路由,负载均衡等过滤需求。
问题:启动zuul服务时,报错,无法启动
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
主要是springboot的版本与是springcloud的版本兼容出现问题,需要调整springboot,springcloud和zuul的版本
springboot:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.1.RELEASE</version>
<relativePath/>
</parent>
springcloud:
<spring-cloud.version>Greenwich.RC1</spring-cloud.version>
zuul依赖:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
<version>2.2.0.RC1</version>
</dependency>