No Spring WebApplicationInitializer types detected on classpath异常的解决

1.问题描述,当配置成

时,通过地址栏访问默认路径的index.jsp报404错误,如果手动在浏览器输入“http://localhost:8080/index.jsp”,则出现源码文件,然后观察eclipse的console控制台,发现有一行红色的“信息: No Spring WebApplicationInitializer types detected on classpath

2.解决办法,把“<url-pattern>/*</url-pattern>””改成“<url-pattern>/</url-pattern>”,发现就可以正常访问了。

3.关于/*/的区别,
  <url-pattern>/</url-pattern>  会匹配到/login这样的路径型url,不会匹配到模式为*.jsp这样的后缀型url
  <url-pattern>/*</url-pattern> 会匹配所有url:路径型的和后缀型的url(包括/login,*.jsp,*.js和*.html等)

原文地址:https://www.cnblogs.com/fengyuzhongdexiongying/p/7257570.html