New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ExceptionHandler not called for HttpMediaTypeNotSupportedException #29120
Comments
In general, it is a good idea to provide an actual sample to debug the issue. I'll have to ask for that in this case since I can't reproduce the issue otherwise. |
I did some more tests. If I change the
I also tried with I created a sample project at https://github.com/wimdeblauwe/spring-issue-29120 If you run it and access http://localhost:8080 with a http client, you will see that the custom exception handler is not called. If you comment out the |
This comes down once again to the fact there is no matching handler. The The only other suggestion I can think of is that you can inject the |
I have |
Your exception handler is already active for |
Given a very simple Spring Boot 2.7.3 on Java 17 project with only
spring-boot-starter-web
as dependency.If I have this controller:
Then the exception stack trace is printed. However, when I change the
@GetMapping
to this:Then there is a
org.springframework.web.HttpMediaTypeNotSupportedException
as expected, but the exception handler is not called and no stacktrace is printed.I also tested with a separate
@ControllerAdvice
class, but the behavior is the same:I would like to handle this exception in my error handling library, but I don't know why it never arrives in my exception handler.
The text was updated successfully, but these errors were encountered: