views:

382

answers:

2

Hello Everyone,

I'm converting a standard Java Application that uses Spring Framework into a Web App. This application loads new Spring Context based on run-time parameters, that was done using ClassPathXmlApplicationContext/FileSystemXmlApplicationContext.

So my question is how to do the same in a Web Application given that I already configured my web.xml and added Spring Listeners as below:

<listener>
 <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

Another Problem, my deployment environment is on Tomcat 5.5 where I'm not able to see any logging during spring context loading to know what's wrong.

Thanks a lot.

+2  A: 

If you actually mean to load a configurable context on start up of your weblication you could configure your web.xml with a property placeholder for the context name.

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:${my_context_file}</param-value>
</context-param>
mR_fr0g
I like this parameter approach.
KLE
+1  A: 

To turn on logging you may need to set it in your log4j.properties file, like so: log4j.logger.org.springframework=DEBUG

You also have to ensure that you are logging to the CONSOLE and not some other stream. If you are then log messages should appear in catalina.out

harschware