No mapping found for HTTP request with URI [xxxx/xxx] in DispatcherServlet with dispatche
程序员文章站
2022-07-15 13:25:11
...
出现的问题:
使用RequestMapping注解指定路径进行跳转,结果死活就是404 检查路径无问题,检查控制台出现了一个问题
报错信息:
No mapping found for HTTP request with URI [/SpringMVC_Demo2] in with dispatche
解决方案
上面的错误,大概意思就是DispatcherServlet中找不到对应的注入
- 编码问题,源码和配置文件,编码必须一样。例如源码是GBK编码,配置文件是UTF-8编码。就会出现这个问题。
- MVC配置文件中没有写扫描注解,加上一行代码即可
<!-- 对包进行扫描,实现注解驱动Bean的定义,同时将Bean自动注入容器中使用 -->
<!-- 让标注了@Controller的Bean成为一个可以处理请求的控制器 -->
<context:component-scan base-package="cn.smbms.controller"/>
- Spring配置文件和SpringMVC配置文件没有放在一起,会导致无法注入
注:答主自己的问题是第一种,其余两种是CSDN大佬[一年e度的夏天]发的,根据这个大佬的思路进行一个总结,如有侵权请联系删除后两种方式!
上一篇: 遗传算法
推荐阅读
-
No mapping found for HTTP request with URI [/springmvc-1/springmvc/testParamsAndHeaders] in Dispatch
-
vue+No mapping found for HTTP request with URI [*//**] in DispatcherServlet with name ‘springMvc‘
-
异常记录二:寻求解决异常 !No mapping found for HTTP request with URI
-
如何解决“ No mapping found for HTTP request with URI [XXX] in DispatcherServlet with name 'XXX' ”
-
警告: No mapping found for HTTP request with URI [/springmvc-01/helloworld] in DispatcherServlet with
-
No mapping found for HTTP request with URI [/xxx/xxx] in DispatcherServlet with name 'xxx'
-
No mapping found for HTTP request with URI [...] in DispatcherServlet with name ‘DispatcherServlet‘
-
No mapping found for HTTP request with URI [***.html] in DispatcherServlet with name "***"
-
No mapping found for HTTP request with URI [/HelloWeb/] in DispatcherServlet with name 'HelloWeb...
-
No mapping found for HTTP request with URI [/app17a/] in DispatcherServlet with name 'springmvc'解决方法