Hi, all:
I am trying to create a static class, which would return ApplicationContext. I am using pieces of code from this forum, but I am getting an exception.
The code is:
beanRefContext is:Code:public static ApplicationContext getApplicationContext(String applicationName) { if( applicationContext == null ) { synchronized( lock ) { if( applicationContext == null ) { BeanFactoryLocator bfl = ContextSingletonBeanFactoryLocator.getInstance(); BeanFactoryReference bf = bfl.useBeanFactory(applicationName); applicationContext = (ApplicationContext) bf.getFactory(); } } } return applicationContext; }
Exception is:Code:<beans> <bean id="test.this.thing" lazy-init="true" class="org.springframework.context.support.ClassPathXmlApplicationContext"> <constructor-arg> <list> <value>/WEB-INF/applicationContextWeb.xml</value> <value>/com/greenview/fpi/util/applicationContextUtil.xml</value> </list> </constructor-arg> </bean> ...
I would greatly appreciate any help.Code:org.springframework.beans.FatalBeanException: Returned bean is not BeanFactory or its subclass. lookup ID [test.this.thing], factory key [test.this.thing], from group with resource name [classpath*:beanRefContext.xml]. Returned object class is [org.springframework.context.support.ClassPathXmlApplicationContext] at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:408)
Thanks.


Reply With Quote