you can add your CustomException and add exceptionHandler
@ControllerAdvice Classtry to override handleMethodArgumentTypeMismatch
@ExceptionHandler({TestExceptionMethodArgumentTypeMismatchException.class}) public ResponseEntity<Object> testExceptionhandleMethodArgumentTypeMismatch(TestException eMethodArgumentTypeMismatchException ex, ServletWebRequestWebRequest request) { ... return new ResponseEntity(); } Custom Exception class
public class TestException extends RuntimeException { public TestException() { super(); } public TestException(String message) { super(message); } }