【发布时间】:2019-09-03 15:42:54
【问题描述】:
我有一个 Spring Boot REST 应用程序。当路径不存在时,我需要返回 400 bad request 的状态码。考虑:
This is a good url
localhost:8080/mypath?name=test
Bad Path (return status 400)
localhost:8080/mybadpath?name=test
如何使用 Spring Boot 来做到这一点
【问题讨论】:
-
您不应该返回 404 吗? :)
-
哪个版本的spring boot?
-
@Deadpool 它的 spring boot 2.1.3
-
我试过
2.1.0它对我有用试试我的答案@Luke101 -
@TheLostMind 实际上,我必须这样做。选择不取决于我。
标签: java spring-boot