spring cloud eureka 初始化报错(A bean with that name has already been defined)

报错内容

The bean 'eurekaRegistration', defined in class path resource [org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration E u r e k a C l i e n t C o n f i g u r a t i o n . c l a s s ] , c o u l d n o t b e r e g i s t e r e d . A b e a n w i t h t h a t n a m e h a s a l r e a d y b e e n d e f i n e d i n c l a s s p a t h r e s o u r c e [ o r g / s p r i n g f r a m e w o r k / c l o u d / n e t f l i x / e u r e k a / E u r e k a C l i e n t A u t o C o n f i g u r a t i o n EurekaClientConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration EurekaClientConfiguration.class],couldnotberegistered.Abeanwiththatnamehasalreadybeendefinedinclasspathresource[org/springframework/cloud/netflix/eureka/EurekaClientAutoConfigurationRefreshableEurekaClientConfiguration.class] and overriding is disabled.

排查

原因大概就是依赖冲突、版本冲突之类的,根据以下答案尝试后没有修复:

https://stackoverflow.com/questions/62868281/bean-eurekaregistration-defined-in-class-path-resource-could-not-be-registere

https://developer.baidu.com/article/details/3234921

https://www.volcengine.com/theme/8366164-OTHER-7-1

最后发现引用了 spring-cloud-context,怀疑是版本冲突,去掉后问题修复。

相关推荐
算法与双吉汉堡11 小时前
【短链接项目笔记】Day2 用户注册
java·redis·笔记·后端·spring
佛祖让我来巡山11 小时前
接着唠:三级缓存为啥是“刚需”?没有它Spring工厂得“停工”!
spring·三级缓存·spring三级缓存
北漂IT民工_程序员_ZG12 小时前
SpringBean生命周期,动态代理
java·spring boot·spring
老华带你飞12 小时前
建筑材料管理|基于springboot 建筑材料管理系统(源码+数据库+文档)
java·数据库·vue.js·spring boot·后端·学习·spring
zhangyifang_00913 小时前
Spring中的BeanFactory类
java·后端·spring
R.lin15 小时前
Spring AI Alibaba 1.1 正式发布!
java·后端·spring
程序员阿明15 小时前
spring security 6的知识点总结
java·后端·spring
running up15 小时前
Spring Bean生命周期- BeanDefinition 加载与 BeanFactoryPostProcessor BeanPostProcessor
java·后端·spring
Java水解16 小时前
Spring AOP原理深度解析:代理模式、JDK动态代理与CGLIB
后端·spring
running up18 小时前
Spring核心深度解析:AOP与事务管理(TX)全指南
java·数据库·spring