Reputation: 39
Also can anyone explain this with reference to the statement mentioned below which was going through from spring-reference.
If you do not want to use Spring's web MVC, but intend to leverage other solutions that Spring offers, you can integrate the web MVC framework of your choice with Spring easily. Simply start up a Spring root application context through its ContextLoaderListener, and access it through its ServletContext attribute (or Spring's respective helper method) from within a Struts or WebWork action. No "plug-ins" are involved, so no dedicated integration is necessary.
Upvotes: 1
Views: 1116
Reputation: 223
servlet context is the root of your web application directory. Everything else is given reference relative to it. Context loader listener is secod way of loading spring context, first being by use of dispatcher servlet.
Application Context is the container initialized by a ContextLoaderListener or ContextLoaderServlet(dispatcher-servlet) defined in the web.xml
Upvotes: 0
Reputation: 7111
That means that if you don't want to use Spring MVC use a ContextLoaderListener to bootstrap an WebApplicationContext in the ServletContext. Something like this:
<!-- Bootstrap the root application context as usual using ContextLoaderListener -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
And then use WebApplicationContextUtils method getRequiredWebApplicationContext(ServletContext sc) (or other many ways) to get the WebApplicationContext and get access to your Spring Beans.
You can do this in any part of your application (as long as you can get a ServletContext). This means that you don't have to integrate Spring to other technologies.
Upvotes: 1