<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<!-- Configure DispatcherServlet to use AnnotationConfigWebApplicationContext
instead of the default XmlWebApplicationContext -->
......
</servlet>
添加依赖
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
即可解决
本文详细介绍了如何在Spring MVC中配置DispatcherServlet,并解释了如何指定使用AnnotationConfigWebApplicationContext而非默认的XmlWebApplicationContext。同时,文章提供了添加spring-webmvc依赖的具体方式。
1万+





