问题描述:Servlet3模块化应用中,@Controller没有被注入,导致出现:

org.springframework.web.servlet.DispatcherServlet noHandlerFound

警告:No mapping found for HTTP request with URI [/xxx/xxx] in DispatcherServlet with name 'springmvc'

特别说明:在独立的站点应用中不会存在这个问题。

Servlet3模块化应用中,@Controller没有被注入,导致出现:No mapping found for HTTP request with URI [/xxx/xxx] in DispatcherServlet with name 'springmvc'-LMLPHP

警告: No mapping found for HTTP request with URI [/wrbots%2Dit%2Dweb%2D10%2D20180410/registerView] in DispatcherServlet with name 'springMVC'

解决方案:

把spring的配置文件放在一起。例如:都放在src/main/resources下的config文件夹中

Servlet3模块化应用中,@Controller没有被注入,导致出现:No mapping found for HTTP request with URI [/xxx/xxx] in DispatcherServlet with name 'springmvc'-LMLPHP

另一种错误情况,配置文件中写错了路径

Servlet3模块化应用中,@Controller没有被注入,导致出现:No mapping found for HTTP request with URI [/xxx/xxx] in DispatcherServlet with name 'springmvc'-LMLPHP

实际文件夹是conf,配置中却写成了config,当然找不到了。

05-11 13:29