I am Spring newbie - so forgive any clueless questions :-)
When my units tests are run on Weblogic (via Cactus) - Weblogic is reporting connection pool leaks (manifested when the app attempts to create a new DAO bean).
I *think* I know what the problem is - but I dont know the best way to fix it.
I am obtaining the app context via a static factory class (calls ClassPathXmlApplicationContext). Once the factory has been created, I hang on to the static reference - and use that to create all my beans.
My naive assumption was that the factory would only get created once (this is indeed the case when I run my test code out of container) - but from my log files I can see that Weblogic runs the static code several times (appears to be every time a new cactus test servlet is run). I suspect this is causing the connection leaks? Weblogic must be creating a new classloader every time the test servlet runs?
So what I want is for the factory to be created only once.
I have read about the using web.context.ContextLoaderListener - but my challlenge is this a layered application - and my backend tier doesnt have access to the servlet context.
How can I ensure that only one factory gets created, and how can I access that factory in my backend tier (without having acess to the servlet context).
Any pointers/suggestions welcome