This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Craig Walls wrote:Put simply: The "Application Context" is another name for the Spring container. Spring's primary job is to manage the lifecycle and relationships between a lot of objects. It does that by loading them in its container.
To load the container..well there are several answers to that, depending on how you build your application. Typically, there's one or more XML files that contains one or more <bean> declarations (although these XML files keep getting smaller thanks to some special namespaces, annotations and autowiring).
If it's a web application then those XML files are loaded by either DispatcherServlet and/or ContextLoaderListener. If it's an OSGi bundle, then they're loaded by the Spring-DM extender. If it's a standalone (e.g., has a main() method) application, then you might load them a little something like this:
And there are other ways to load it...kinda depends on the circumstance, though.
I'm very much interested to know all other ways to load contexts apart from web application and standalone java application
If you don't like something, change it. If you can't change it, change your attitude. Don't complain.
Interested to know what would be the recommended way to load the context in a messaging application i.e. the entry point is JMS message.
I have initially created RAR and deployed in app server's resource adapter but it turned out to be pain in development as it required server restart after every deployment + few other issues.
Then, wrapped that RAR into an EAR and deployed as normal sever application. So far, this is working fine but I am not sure if it is a recommended solution or just workaround.