Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Different Application Context implementations

 
Nitin Gaur
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Nitin Gaur
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic