Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Relation between ContextLoaderListener application context and WebApplicationContext

 
Ganesha Kumar
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Suppose I create an application context using ContextLoaderListener. And I am using Spring MVC. The DispatcherServlet is also having its WebApplicationContext. What is the relationship between these two application contexts.

Thanks,
Ganesh
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The WebApplicationContext of DispatcherServlet inherits the beans defined in the root WebApplicationContext.
You can read http://static.springsource.org/spring/docs/2.5.6/reference/mvc.html for more information.
 
Ganesha Kumar
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are there 2 Spring containers one created by ContextLoaderListener and another by DispatcherServlets? If yes, then if the beans in the rootAppplicationContext are inherited by the WebApplicationApplication, do they live in 2 Containers?

Thanks,
Ganesh
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the documentation, yes. You can have a look at source code if you're really curious.
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The DispatcherServlet provides a gateway to the server and every request of the application workflow involved with HTTP-based request-response handling done by DispatcherServlet.

WebApplicationContext is a special type of context. And it is combine with dispatcher servlet and manages all components as controllers, mappings between URLs, and interceptors, views.

WebApplicationContext doesn't much difference from normal ApplicationContext.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic