|
|
One of the issues I have working with Spring under Weblogic Server is its startup/shutdown classes. In addition to not being portable, any startup class which requires a JMS ConnectionFactory won't be able to take advantage of Weblogic's JMS Wrapper functionality, which is basically how Weblogic exposes JMS resource pooling, which requires a resource-ref (which by inference needs an EJB or servlet).
Fortunately, since Spring can manage objects in its appliation context, you can create one startup/shutdown class for Spring and just initialize it with different XML files.
Why even use a startup/shutdown class? You might have a singleton service (like a scheduler or a cache) you want initialized only once on a server instance that isn't associated with a web application. A messaging application for example.
But ContextLoaderListener and ContextLoaderServlet already take a list of XML files. Plus they are part of a web application, which allows resource-ref's. So why not use a web app to load your Spring XML files, even if you don't have a front end. And as an added bonus its portable. You could move this code to Tomcat without too much trouble.
As it turns out, this isn't an original idea. Debu Panda talked about this a few years ago (here) and Vinny Carpenter expanded on it (blog/2004/05...down-classes/). This is just implementing it with Spring.
What's even cooler is it would be easy to write a very simple JSP page that could list all of the managed beans in the application context and using BeanWrapper create a simple management console for gettings and setting values. Acegi could be used to secure it. Of course at that point you'd be adding a front end to your application, but it could be a generic one that integrates into Spring and not a custom one that you would have to write if you wanted equivalent functionality from a non-Spring solution.
Comments?
Oh and another benefit to ContextLoader related classes is it supports a parent context out of the box. That would allow you to have locally configured objects and still integrate with a shared context using a SingletonBeanFactoryLocator.
I've read the post several times but I'm still missing the idea - Spring provides the Listener and Servlet classes (which you mentioned) - what extra functionality would you like to see (I found only Debu's blog which mentioned using the J2EE mechanism instead of an application server specific).
The reason why you can't see the request for additional functionality is that there isn't one
I was just bringing up the idea of how perfectly ContextLoaderListener makes a great startup class loader. You just pass it a list of XML files. No coding required. And it solves the one issue I have with Spring based startup classes and Weblogic.
Ahhh... indeed! I'm used to answering questions on the forum so I tend to look at most topic starters as questions . |
|