错误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 这个配置就行了。