Slide 4
Slide 4 text
Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a
Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Keep it DRY
4
@ResponseStatus(CREATED)
HttpHeaders create(
@RequestBody UserInput userInput) {
…
}
@ExceptionHandler(
IllegalArgumentException.class)
ResponseEntity illegalArgument() {
return new ResponseEntity<>(BAD_REQUEST);
}
@ApiResponses({
@ApiResponse(code=400, message="…"),
@ApiResponse(code=201, message="…")})
return new ResponseEntity<>(BAD_REQUEST);