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,怀疑是版本冲突,去掉后问题修复。

相关推荐
Mr.朱鹏6 小时前
Nginx路由转发案例实战
java·运维·spring boot·nginx·spring·intellij-idea·jetty
代码丰9 小时前
SpringAI+RAG向量库+知识图谱+多模型路由+Docker打造SmartHR智能招聘助手
人工智能·spring·知识图谱
wr20051410 小时前
第二次作业,渗透
java·后端·spring
短剑重铸之日12 小时前
《SpringCloud实用版》 Seata 分布式事务实战:AT / TCC / Saga /XA
后端·spring·spring cloud·seata·分布式事务
短剑重铸之日14 小时前
《SpringCloud实用版》统一认证授权:Spring Authorization Server + OAuth2 + JWT 生产级方案
java·后端·spring·jwt·oauth2
cookqq15 小时前
基于Spring AI+本地大模型+MongoDB实现私密化与记忆能力-企业级免费大模型应用
人工智能·mongodb·spring
哪里不会点哪里.16 小时前
什么是 Spring Cloud?
后端·spring·spring cloud
山上三树16 小时前
详细介绍读写锁
开发语言·c++·spring
树码小子16 小时前
Spring框架:Spring程序快速上手
java·后端·spring
老毛肚17 小时前
uniapp-ruoyi-spring部署宝塔
java·spring·uni-app