call to get hold of the already instantiated ApplicationContext ?
I am trying to access a Spring bean (defined in teh applicationContext.xml) in the service/business layer. The question is , how do you reach the application context?
The Spring reference has example of loading the xml file directly. That approach (below)
Code:
ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
LocationService locationService = (LocationService) context.getBean("locationService");
I notice that the entire Container(including the sessionFactory, dataSource, etc.) gets instantiated each time I do the above I just want to get the context which was loaded in the ContextLoaderListener listener (loaded in web.xml as below) and call getBean to get to my beans.
Code:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:applicationContext.xml
</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
What is the call to get hold of the already instantiated ApplicationContext ? (There are multiple classes from where I need to get access to the various spring Beans.)
P.S : This is GWT application
Thank you,