You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
400 Bad Request for missing URI template variable is incorrect [SPR-13121] #17712
If I have a controller which has a method whose RequestMapping is incorrect as follows:
@RestController
public class HelloController {
@RequestMapping("/test/{a}")
public String test(@PathVariable String b) {
return "ok";
}
}
Then I request '/test/1' the server will response with 400 Bad Request as follows:
{"timestamp":1434182424954,"status":400,"error":"Bad Request","exception":"org.springframework.web.bind.ServletRequestBindingException","message":"Missing URI template variable 'b' for method parameter of type String","path":"/test/aaa"}
But 400 Bad Request is incorrect for this situation because it was not a client error but a server error, because there is no way to request correctly without modifying the server.
Activity