org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/classes/springContext.xml]; nested exception is java.lang.IllegalStateException: Annotation-specified bean name 'cardController' for bean class [com.qdzq.wlpt.controller.api.CardController] conflicts with existing, non-compatible bean definition of same name and class [com.qdzq.wlpt.controller.admin.CardController]不同包下的文件不是可以重名嗎?
2 回答

繁星淼淼
TA貢獻1775條經驗 獲得超11個贊
你有2個CardController,自動注入后bean的id就沖突了,如果2個都想要,在spring文件里面配置2個bean,設置成不同的id,就不會沖突了,spring默認bean的id就是類名首字母小寫
添加回答
舉報
0/150
提交
取消