2013-12-13 4 views
0

Spring 애플리케이션 (웹 서비스 또는 MVC 애플리케이션이 아닌 Geronimo 서버에서 실행되는 싱글 톤 애플리케이션)을 구축 중입니다. 로드시, 프로토 타입 bean 세트를 관리하는 내부 어플리케이션 컨텍스트에 액세스하려고합니다. 기본적으로이 bean의 완전한 종료를 위해 계층 적 애플리케이션 컨텍스트를 사용하여 모든 프로토 타입 bean을 관리하려고합니다.커스텀 웹 애플리케이션 컨텍스트 만들기 [SPRING]

기본적으로 보조 서블릿 (나에게 최선의 선택처럼 보이지 않는)을 생성하고 그들에게

접근 아니면 GenericWebApplicationContext를 사용 (다른 모든의 WebApplicationContext는 관련 시도 :

나는 다음과 같이 다양한 방법 바라 보았다 API)를 사용하십시오.

GenericWebApplicationContext context = new GenericWebApplicationContext(servletContext); 
context.setParent(rootApplicationContext); 
XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(context); 
xmlReader.loadBeanDefinitions(new ClassPathResource("ApplicationContext/beans.xml")); 
context.refresh(); 

접근 방법에 대해 의견을 말하십시오. 제안 된 접근 방법이 있습니까?

2013-12-13 00:44:04,877 ERROR [ContextLoader] Context initialization failed 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ZKWatcherImpl' defined in URL [bundleresource://382.fwk1189431013/com/ebay/traffic/email/aggregate/watcher/ZKWatcherImpl.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.ebay.traffic.email.aggregate.watcher.ZKWatcherImpl]: Constructor threw exception; 
nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/context] Offending resource: class path resource [CustomContext.xml] 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:997) 

주셔서 감사합니다 예외 전면에

+0

사람들도 CustomConetxt.xml을보고 싶습니다. –

답변

0

올바르게 실제로 사용자 정의 네임 스페이스를 가져되지 않습니다

n 개의 추가는 또한 다음과 같은 오류가 발생했습니다. dtd가 없거나 CustomContext.xml의 올바른 공용 위치를 나타내지 않습니다.

당신의 주된 질문에 왜 두 번째 servlrt 또는 WebApplicationContext 자체가 필요합니까? 당신은 SO 먼저 당신의 적절한 요구 사항이

Spring: How to cleanly terminate prototype-scoped beans?

검색 같은 그 위에 많은 질문이 있습니다 프로토 타입 빈을 관리해야합니다. 너는 많은 것을 얻을 것이다.

+0

안녕하세요 manocha_ak, 의견에 감사드립니다. 그것을 들여다 볼 것입니다. 사용자 지정 웹 컨텍스트에서 주제를 검색했지만이 사용 사례를 생각하지 않았습니다. 지적 해 주셔서 고마워요. 정말 감사합니다. 감사합니다. Dheeban – dheeban

관련 문제