org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL

【报错】

org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [file:/F:/MyWorkspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/marbled-cat/WEB-INF/classes/spring-servlet.xml]; nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'merchantController' for bean class [org.mcc.merchant.controller.MerchantController] conflicts with existing, non-compatible bean definition of same name and class [org.mcc.campus.manager.controller.MerchantController]
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:414)

 

【可能产生原因】

不同的package里有两个名字相同的类,只是类所在的目录不同。

 

【解决方法】

spring管理bean大概类似把bean实例化放到map中,它会以配置的id和name(如果配置的话)为key存放起来,

2个一样的肯定要成冲突,应该给他们换个名字就成啦

 

类似于

controller("systemHomeController")
controller("moduleHomeController")

  

posted @ 2018-07-07 00:46  Frankiee  阅读(2969)  评论(0编辑  收藏  举报