Closed
Description
Yi EungJun opened SPR-13121 and commented
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.
Affects: 4.1.6
Issue Links:
- Specific exceptions for missing request headers, cookies, etc [SPR-14818] #19384 Specific exceptions for missing request headers, cookies, etc
- InvocableHandlerMethod.getMethodArgumentValues() failure should lead to warn-level logging by default [SPR-13267] #17858 InvocableHandlerMethod.getMethodArgumentValues() failure should lead to warn-level logging by default
Referenced from: commits 4b05bda