@ResponseStatus to Set HTTP Status Code

preview_player
Показать описание
@ResponseStatus to Set HTTP Status Code. There is explanation about how you can set HTTP response in spring and spring boot for API.

@RequestMapping("/bad")
@ResponseStatus(code = HttpStatus.BAD_REQUEST, reason = "Some parameters are invalid")
void onIllegalArgumentException(IllegalArgumentException exception) {}
Рекомендации по теме