用@Controller注解导致请求报404错误
POST http://localhost:8080/user/login
HTTP/1.1 404
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json
Content-Language: zh-CN
Transfer-Encoding: chunked
Date: Sun, 15 Oct 2023 15:21:26 GMT
Keep-Alive: timeout=60
Connection: keep-alive
{
"timestamp": "2023-10-15T15:21:26.700+00:00",
"status": 404,
"error": "Not Found",
"message": "No message available",
"path": "/user/login"
}
Response code: 404; Time: 1124ms; Content length: 132 bytes
将controller层的@Controller换成@RestController
接口测试成功!
@RestController和@Controller的区别
csdn记录第一篇文章,特别感谢大佬:大佬博客