Hellu,
I have several spring components with their own spring configuration.
I use these components in my web app and as such need to load all their spring config files. I can do that in my web.xml as follows:
The problem with this is that I like load different spring config files, depending on the environment I am running in (set as JVM param).
Normally I do this like this (contained in the spring config, referenced in the web.xml):
But, I can't do that in this case as I am using the DispatcherServlet that inherits the root Context but of course can't find the beans loaded above, as they are contained in a child of the root context.
So what I want: add these beans to the root context instead as to load them in a new context and add this as a child.
How can I do that ?
Please some advice?
Ed
I have several spring components with their own spring configuration.
I use these components in my web app and as such need to load all their spring config files. I can do that in my web.xml as follows:
Code:
<context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring/default/index-*.xml</param-value> </context-param>
Normally I do this like this (contained in the spring config, referenced in the web.xml):
Code:
<bean id="bv-web-app" class="org.springframework.context.support.ClassPathXmlApplicationContext"> <constructor-arg> <list> <value>classpath*:spring/default/index-*.xml</value> <value>classpath*:spring/${app.environment}/index-*.xml</value> </list> </constructor-arg> </bean>
So what I want: add these beans to the root context instead as to load them in a new context and add this as a child.
How can I do that ?
Please some advice?
Ed
Comment