0 votes
in Spring by

What is DispatcherServlet and ContextLoaderListener?

1 Answer

0 votes
by

DispatcherServlet is the front controller in the Spring MVC application and it loads the spring bean configuration file and initialize all the beans that are configured. If annotations are enabled, it also scans the packages and configure any bean annotated with @Component, @Controller, @Repository or @Service annotations.

ContextLoaderListener is the listener to start up and shut down Spring’s root WebApplicationContext. It’s important functions are to tie up the lifecycle of ApplicationContext to the lifecycle of the ServletContext and to automate the creation of ApplicationContext. We can use it to define shared beans that can be used across different spring contexts.

Related questions

0 votes
asked Apr 4, 2021 in Spring by Robindeniel
0 votes
asked Jul 28, 2020 in Spring by sharadyadav1986
...