Bookmark Topic Watch Topic
  • New Topic

Spring application context

 
Lisa Bass
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Report post to moderator
being new to spring...
I have been asked a question in interview

What is spring ApplicationContext??

How you load it?

can someone provide me with the answers of these two???

thanks
lisa
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
Check the online manual : 3.1 Introduction to the Spring IoC container and beans
 
Craig Walls
author
Ranch Hand
Posts: 363
8
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
Nitin Gaur,
Your post was moved to a new topic.
 
    Bookmark Topic Watch Topic
  • New Topic