错误could not be registered. A bean with that name has already been defined in class path resource


问题:

 

 springbppt有两个模块,mail和server,启动mail的时候报错:

1 Description:
2 
3 The bean 'queue', defined in com.hyf.MailAppAplication, could not be registered. A bean with that name has already been defined in class path resource [com/hyf/server/conf/RabbitMQConfig.class] and overriding is disabled.
4 
5 Action:
6 
7 Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true

可以看到是因为server模块里面已经注册了一个queue的bean了,所以mail里面再注册会提示已存在。

解决:

根据提示,在mail的配置文件里面加入   spring.main.allow-bean-definition-overriding=true  这个配置就行了。

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM