关于springmvc的静态资源映射问题

来源:互联网 发布:cnc数控编程仿真软件 编辑:程序博客网 时间:2024/05/16 09:46

springDispatcher文件里我是这么写的。

     <!-- 静态资源 -->    <mvc:default-servlet-handler /> <mvc:resources mapping="/images/**" location="/images/" /><mvc:resources mapping="/js/**" location="/js/" /><mvc:resources mapping="/css/**" location="/css/" /><mvc:resources mapping="/fonts/**" location="/fonts/" /><mvc:resources mapping="/swagger/**" location="/WEB-INF/swagger/"/>


这是项目的目录。

然后我发现一个问题,当我通过controller跳转页面,如果在类上定义一个RequestMapping路径,静态资源就会映射失败,就像这样,

@Controller@RequestMapping("/api/wsq")public class WsqController {@RequestMapping(value="order")public String phoneRegister(){return "order";}@RequestMapping("/index")public String showIndex(){return "index";}}


当我把@RequestMapping("/api/wsq")去掉的时候,静态资源就会映射成功,有没有什么解决的办法

0 0
原创粉丝点击