Closed
Description
mpapenbr opened SPR-17394 and commented
Given a class with @ControllerAdvice
annotation
@ControllerAdvice
@RequestMapping(produces = { "application/vnd.someapp-v1.0+json;charset=utf-8" })
public class RestErrorHandler {
...
@ExceptionHandler(OperationWithProblemsException.class) @ResponseStatus(HttpStatus.UNPROCESSABLE_ENTITY)
@ResponseBody public OperationResult processOperationWithProblemsException(OperationWithProblemsException ex) {
return ex.getResult();
}
When running with Spring 5.0.X the content type specified in the produces-attribute of the RequestMapping annotation was respected and sent to the client upon this exception.
Starting with Spring 5.1.0 this has somehow changed and now I get
application/json;charset=UTF-8
instead of the expected
application/vnd.someapp-v1.0+json;charset=utf-8
Affects: 5.1.1
Issue Links:
- @RequestMapping produces condition should not impact error responses [SPR-16318] #20865
@RequestMapping
produces condition should not impact error responses