Annotation-specified bean name conflicts with existing, non-compatible bean def

后端 未结 13 838
再見小時候
再見小時候 2021-01-31 01:51

I\'m having a problem with some Spring bean definitions. I have a couple of context xml files that are being loaded by my main() method, and both of them contain almost exclusiv

13条回答
  •  南笙
    南笙 (楼主)
    2021-01-31 01:58

    I also had a similar problem. I built the project again and the issue was resolved.

    The reason is, there are already defined sequences for the Annotation-specified bean names, in a file. When we do a change on that bean name and try to run the application Spring cannot identify which one to pick. That is why it shows this error.

    In my case, I removed the previous bean class from the project and added the same bean name to a new bean class. So Spring has the previous definition for the removed bean class in a file and that conflicts with the newly added class while compiling. So if you do a 'build clean', previous definitions for bean classes will be removed and compilation will success.

提交回复
热议问题