package zti.lab05c2.exception; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus; import zti.lab05c2.model.Person; @ControllerAdvice class PersonNotFoundAdvice { @ResponseBody @ExceptionHandler(PersonNotFoundException.class) @ResponseStatus(HttpStatus.NOT_FOUND) String employeeNotFoundHandler(PersonNotFoundException ex) { return ex.getMessage(); } }