解决启动Zuul时报错:The bean ‘proxyRequestHelper‘, defined in class path resource [org/springframework/cloud

解决启动Zuul时报错:The bean ‘proxyRequestHelper‘, defined in class path resource [org/springframework/cloud

leo 755 2021-04-10

具体报错信息

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

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版本为2.1.7.RELEASE,SpringCloud的版本为Finchley.RELEASE

解决

SpringCloud版本不变,将SpringBoot版本改为2.0.x.RELEASE即可。或者SpringBoot版本不变,将SpringCloud版本改为Greenwich版本。

SpringBoot、SpringCloud版本适配表

SpringBoot、SpringCloud版本适配表
图片中内容来自Spring官网。第一列是SpringCloud的版本,第二列是兼容的SpringBoot的版本。