Have this code inside ControllerAdvice:
@ExceptionHandler(value = Exception.class)
@ResponseStatus(value = INTERNAL_SERVER_ERROR)
protected ResponseEntity<ApiError> handleAnyException(Exception ex, WebRequest request) {
for custom exception and BindingException.class in the same ControllerAdvice the ex.getMessage() is not null.
Running the application not with spring graalVM native image also works fine and for Exception class ex.getMessage() is not null as well.
But running the app on spring native image the ex.getMessage() is null only for the Exception.class handler.
What can be the reason for this different behavior ?