0
달성하려는 목표는 하나의 병과 두 개의 war 사이에서 Spring 컨텍스트를 공유하는 것입니다. 그들 모두는 귀에 모여있다. 여기 EAR에서 Spring 공유 컨텍스트
은 beanRefContext.xml로는 항아리에 있습니다<bean id="mainApplicationContext"
class="org.springframework.context.support.ClassPathXmlApplicationContext">
<constructor-arg>
<list>
<value>/META-INF/spring/main-applicationContext.xml</value>
</list>
</constructor-arg>
</bean>
메인 applicationContext.xml 내가 두 전쟁 사이에 공유하고 싶습니다 콩이 포함되어 있습니다.
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listenerclass>
</listener>
<context-param>
<param-name>locatorFactorySelector</param-name>
<param-value>/META-INF/spring/beanRefContext.xml</param-value>
</context-param>
<context-param>
<param-name>parentContextKey</param-name>
<param-value>mainApplicationContext</param-value>
</context-param>
그리고 다른 전쟁에서 유사한 여기
는 하나의 전쟁에서 web.xml을합니다. 내가 분명히 메인 applicationContext.xml에서 모든 콩을 인스턴스화하는 것을 볼 수 있습니다 제이 보스 로그에서:
[org.springframework.beans.factory.xml.XmlBeanDefinitionReader] Loaded 265 bean definitions from location pattern [/META-INF/spring/main-applicationContext.xml]
또 하나의 전쟁이 나는 특정 전쟁 지역의 콩을 포함하는 지역 스프링 컨텍스트가 있습니다. 그 빈들도 제대로 인스턴스화됩니다.
[org.springframework.beans.factory.xml.XmlBeanDefinitionReader] Loaded 55 bean definitions from location pattern [/WEB-INF/applicationContext.xml]
콩은 jar 파일에있는 빈에 올바르게 주입됩니다. 그러나 Struts 액션과 Bean에 삽입되지는 않는다. (/WEB-INF/applicationContext.xml에 정의되어있다.)
beanRefContext.xml은 로컬 웹 컨텍스트의 상위 컨텍스트라고 생각합니다.
어디서 잘못 되었나요?
도움을 주셔서 감사합니다.
이것은 내가 당신을 도울 수 있습니다 http://stackoverflow.com/questions/16162877/spring-mvc-sharing-context-within-ear – constantlearner
constantlearner, 나는 그 게시물을 보았습니다. 나는 마른 전쟁을 벌써했기 때문에 같은 문제라고 생각하지 않습니다. – Damian
디버깅 할 때 웹 컨텍스트가 부모 컨텍스트를 올바르게 설정했음을 알았습니다. 루트 WebApplicationContext : 시작 날짜 [Fri Dec 20 11:22:45 CET 2013]; parent : ApplicationContext 'mainApplicationContext' – Damian