Annotation-specified bean name 'userMapper' for bean class [com.oracle.labormarket.mapper.UserMapper

项目原本是好的,由于我们在写代码的过程中出现问题了,但是并没有重新启动项目,所以当时就没有及时的发现错误,从而也不知道我们修改了哪里出现了错误。
后来在项目启动的时候出现下面的两个错误,真的不知道哪里出了问题,在网上查找了半天,最后突然想起在该项目bug的时候在

Annotation-specified bean name 'userMapper' for bean class [com.oracle.labormarket.mapper.UserMapper_第1张图片
加入了两个jar包,分别是 spring-web 3.17jar和spring-webmvc.3,17jar,才导致出现了这个问题,当我把这两个jar包删掉了之后项目就运行起来了。

在这里可以得出,在项目启动的时候出现一样的错误不一定都是相同的原因造成的

严重: Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [file:/C:/Users/Asus/Documents/workspace-sts-3.9.1.RELEASE/.metadata/.plugins/org.eclipse.wst.server.core/tmp2/wtpwebapps/labormarket/WEB-INF/classes/applicationContext.xml]; nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name ‘userMapper’ for bean class [com.oracle.labormarket.mapper.UserMapper] conflicts with existing, non-compatible bean definition of same name and class [com.oracle.labormarket.mapper.cdg.UserMapper]

二月 16, 2020 10:02:52 上午 org.apache.catalina.core.StandardContext listenerStart
严重: 异常将上下文初始化事件发送到类的侦听器实例.[org.springframework.web.context.ContextLoaderListener]
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [file:/C:/Users/Asus/Documents/workspace-sts-3.9.1.RELEASE/.metadata/.plugins/org.eclipse.wst.server.core/tmp2/wtpwebapps/labormarket/WEB-INF/classes/applicationContext.xml]; nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name ‘userMapper’ for bean class [com.oracle.labormarket.mapper.UserMapper] conflicts with existing, non-compatible bean definition of same name and class [com.oracle.labormarket.mapper.cdg.UserMapper]

你可能感兴趣的:(Java)