Ondřej Božek opened SPR-15781 and commented
Support custom HTTP status codes in @ResponseStatus
similary as they are supported in ResponseEntity
.
Currently @ResponseStatus
accepts only enum values of type HttpStatus
.
Alternatively there could be created some kind of infrastructure for application wide registration of custom status codes, extending standardised HttpStatus
codes.
Affects: 3.2.18, 4.3.9, 5.0 RC2
1 votes, 1 watchers
Comment From: sbrannen
Related to #22872.
Comment From: rstoyanchev
I don't see a way to do that in a good way on @ResponseStatus
. We would have to change the default value from HttpStatus.INTERNAL_SERVER_ERROR
to null which would in turn impact existing code including tools outside of the Spring Framework that check the annotation. We could however update ResponseStatusException
to accept a raw value or create a new RawResponseStatusException
.