搭建springmvc的框架,期间遇到一个非常奇怪的问题(spring版本是3.1.2):
问题描述:
浏览器地址栏输入http://localhost:8080/Spring_2500_Registration_0000/login/uname
直接访问restful接口(get方式),一直无法访问,后台日志打印No mapping found for HTTP request with URI ******,
(不过这个错误产生原因很多,此处不总结)
但是如果将spring-servlet.xml配置文件中的
<mvc:resources mapping="/html/**" location="/html/" />
<mvc:resources mapping="/js/**" location="/js/" />
<mvc:resources mapping="/jquery/**" location="/jquery/" />
静态文件访问配置注释掉,就可以通过上述方式直接访问接口了。
解决办法:
网上查找了很多资料没什么收获,最终无意发现spring-servlet.xml文件中的<mvc:annotation-driven />配置的注释没有打开,打开之后就可以了。
但是原因没想明白……