錯誤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