To get the expected exception in the desired format, GlobalExceptionHandler can be used usually annotated with @ControllerAdvice. But for the custom exception format and the expected HttpCode to work as expected, few other configurations have to be taken into consideration. In API end point along with @RequestBody , you have to add @Valid annotation to consider the request body for validation. The POJO class against which this request object will be mapped should have the @NotNull and similar annotations on fields as required. Also, ensure pom file includes the necessary dependency to support the annotation driven validations.