package au.com.dius.pact.provider.spring; 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.ResponseStatus; @ControllerAdvice public class BookControllerAdviceOne { @ResponseStatus(HttpStatus.NOT_FOUND) @ExceptionHandler(BookNotFoundException.class) public void handle(BookNotFoundException ex) { System.err.println("Caught BookNotFoundException, mapping to HTTP 404."); } }