aspose file tools*
The moose likes Spring and the fly likes Different Application Context implementations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Different Application Context implementations" Watch "Different Application Context implementations" New topic
Author

Different Application Context implementations

Nitin Gaur
Greenhorn

Joined: Sep 06, 2003
Posts: 27
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.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

There are a other ApplicationContext implementations out there

First there are

ClassPathXmlApplicationContext
FileSystemXmlApplicationContext
XmlWebApplicationContext
etc.

Here is a link to the javadoc for ApplicationContext, and you can see implementation classes

http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/context/ApplicationContext.html

"AnnotationConfigApplicationContext,
AnnotationConfigWebApplicationContext,
ClassPathXmlApplicationContext,
FileSystemXmlApplicationContext,
XmlPortletApplicationContext,
XmlWebApplicationContext"

Probably the more common of all of them that are used.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Nitin Gaur
Greenhorn

Joined: Sep 06, 2003
Posts: 27
Thanks for the reply Mark.

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.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

Sounds good to me.

Mark
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Different Application Context implementations