簡體   English   中英

來自不同tomcat Webapp的Spring Bean發生沖突

[英]Conflicting spring beans from different tomcat webapps

我在Tomcat上有兩個spring webapps。 兩者都是具有不同版本的相同應用。

當我運行tomcat時,它捕獲了錯誤:

SEVERE [localhost-startStop-2] org.springframework.web.context.ContextLoader.initWebApplicationContext
Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: 
Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/spring/spring.xml];
nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException:
Annotation-specified bean name 'userService' for bean class 
 [ru.ommega.service.rest.UserService] conflicts with existing, non-compatible
 bean definition of same name and class [ru.ommega.service.UserService]

我的spring.xml具有以下代碼:

<context:component-scan base-package="ru.ommega.dao"/>
<context:component-scan base-package="ru.ommega.service"/>
<context:component-scan base-package="ru.ommega"/>

這兩類人處於不同的戰爭中,那么他們怎么可能發生沖突呢?

版本:

 Tomcat 8.0.14
 Spring 4.3.7

對不起,英語不好

解決了。

我以前做什么:

  • mvn package第一個版本
  • git checkout需要分支
  • mvn package第二版

每個mvn package之前我需要什么

  • IntelliJ IDEA導入Maven更改
  • IntelliJ IDEA同步( ctrl + alt + y
  • mvn clean

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM