单独访问css静态资源,报404错误。查看后台服务器,有如下提示:No mapping found for HTTP request with URI [/sunshine/assets/css/ace-fonts.css] in DispatcherServlet
DispatcherServlet分发请求的时候,找不到对应的mapping,截图如下:
出现上面原因,就是SpringMVC 把所有的请求都拦截了,配置下,不要拦截静态资源。在spring-mvc.xml 下添加如下配置。
<mvc:annotation-driven />
<mvc:resources mapping="/image/**" location="/assets/images/" />
<mvc:resources mapping="/js/**" location="/assets/js/" />
<mvc:resources mapping="/css/**" location="/assets/css/" />
<mvc:resources mapping="/font/**" location="/assets/fonts/" />