访问服务器静态资源报错400

 报错截图:

 服务器输入

localhost/pages/books.html

浏览器端:

服务器端:

Resolved [org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'java.lang.Integer'; nested exception is java.lang.NumberFormatException: For input string: "pages"]

原因发现: 

1.检查静态资源放置位置,并没有发现出错

2.在Controller中发现问题

我这里有两个controller,这两个Controller是一模一样的(备份而已),其中UserController2是备份,我在UserController2把@RequestMapping("/users")注释掉了,以为这样就接收不到请求,实际上访问静态资源的路径都被这个controller拿去处理了,所以有问题

解决办法

 把@RestController注释了,其就发挥不了controller的功能,现在就可以正常访问静态资源了

猜你喜欢

转载自blog.csdn.net/Wjeana/article/details/131061165