• 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
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

ContextLoaderListener and DispatcherServlet Usage

 
Ranch Hand
Posts: 441
2
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

What is the use of ContextLoaderListener and DispatcherServlet? Why do we have 2 different classes?

Thanks in advance!

Regards.
 
Sheriff
Posts: 9697
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
DispatcherServlet as the name suggests is a servlet. So if you are using Spring beans for handling requests (MVC or Rest/Soap) then you need DispatcherServlet. You map the DispatcherServlet to request paths which you want Spring to handle. ContextLoaderListener can be used to only use dependency injection using Spring if you don't have the need for serving requests using Spring MVC/WebServices...
reply
    Bookmark Topic Watch Topic
  • New Topic