In my Spring boot application with packaging type as a war, I configure Spring MVC. As I understand it, we do not need to configure the Servlet dispatcher manually. However, the old web.xml style that I used to configure the Servlet dispatcher, and then I used to pass contextClass and contextConfigLocation as follows
<servlet> <description> </description> <display-name>DispatcherServlet</display-name> <servlet-name>DispatcherServlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <description>contextClass</description> <param-name>contextClass</param-name> <param-value>org.springframework.web.context.support.AnnotationConfigWebApplicationContext</param-value> </init-param> <init-param> <description>contextConfigLocation</description> <param-name>contextConfigLocation</param-name> <param-value>com.xxx.yyy.jdorderspringmvcweb.config.SpringMvcConfig</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet>
I believe this meant that SpringMvcConfig (my custom class with Spring mvc configuration) is the configuration class for Spring MVC ..
However, in Spring boot, if the Servlet dispatcher is configured automatically, how can I pass my own class to the Servlet dispatcher?
In my Spring Boot application, my SpringMvcConfig class is distributed from WebMvcConfigurerAdapter and annotated with the @Configuration class
Help required ...
source share