• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Different Application Context implementations

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds good to me.

Mark
 
Water! People swim in water! Even tiny ads swim in water:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic