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

相关推荐
云烟成雨TD18 小时前
Spring AI Alibaba 1.x 系列【6】ReactAgent 同步执行 & 流式执行
java·人工智能·spring
Java成神之路-19 小时前
SpringMVC 响应实战指南:页面、文本、JSON 返回全流程(Spring系列13)
java·spring·json
砍材农夫19 小时前
spring-ai 第六模型介绍-聊天模型
java·人工智能·spring
云烟成雨TD20 小时前
Spring AI Alibaba 1.x 系列【5】ReactAgent 构建器深度源码解析
java·人工智能·spring
Flittly21 小时前
【SpringAIAlibaba新手村系列】(15)MCP Client 调用本地服务
java·笔记·spring·ai·springboot
Flittly21 小时前
【SpringAIAlibaba新手村系列】(14)MCP 本地服务与工具集成
java·spring boot·笔记·spring·ai
mfxcyh1 天前
基于xml、注解、JavaConfig实现spring的ioc
xml·java·spring
Flittly1 天前
【SpringAIAlibaba新手村系列】(13)Tool Calling 函数工具调用技术
java·spring boot·spring·ai
xdscode1 天前
Spring 依赖注入方式全景解析
java·后端·spring