Hi all,
I want to share the application context between several plain Java clients to reduce the startup time of the Spring container.
Currently I'm using a XmlBeanDefinitionReader to load my beans:
Code:GenericApplicationContext appCtx = new GenericApplicationContext(); XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader( appCtx); xmlReader.loadBeanDefinitions(new FileSystemResource(configfile)); appCtx.refresh(); Service service = (Service) appCtx .getBean("service");
I've done this because of being able to split up my application context into several files and load the configuration via FileSystemResource.
Is it possible to share the context between several clients using the SingletonBeanFactoryLocator and still using the FileReader?
My app-context looks like this:
Code:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <!-- import different backend configuration file --> <import resource="applicationContext-1.xml"/> <import resource="applicationContext-2.xml"/> <import resource="applicationContext-3.xml"/> ....
Cheers,
Pieper


Reply With Quote