No mapping found for HTTP request with URI [] in DispatcherServlet with name 'appServlet'

时间:2023-03-09 02:22:21
No mapping found for HTTP request with URI [] in DispatcherServlet with name 'appServlet'

项目是使用SpringMVC

(1)在浏览器中访问,后台总报错:

No mapping found for HTTP request with URI [] in DispatcherServlet with name 'appServlet'

查了好半天,才发现是Controller没有扫描到

<mvc:annotation-driven  />
<!-- 扫描Controller -->
<context:component-scan base-package="com.winner.controller"/>

注意,不是说Controller上写了个@Controller注解就完事了,Spring没扫描到的话这个注解毛用都没有!!!

这么简单的问题遇到好几次,我也是醉了......