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
Using @ControllerAdvice with WebFlux [SPR-16554] #21097
Comments
Enzo Bonggio commented With this exceptions is the same problem UnsupportedMediaTypeStatusException, NotAcceptableStatusException. When I have starter-web dependency the exception that I'm catching is : |
Rossen Stoyanchev commented I've changed the title since I think the question is specific to WebFlux, not Netty in particular. |
Brian Clozel commented Hello Enzo Bonggio! Thanks for raising this issue and starting the conversation. I've reproduced the behavior you're describing with a sample application. In Spring MVC, both mapping and handling errors can be indeed handled by In Spring WebFlux the situation is a bit different, since mapping errors (content negotiation and HTTP mapping errors) are not handled by that mechanism. One could argue that since a Now we'd still like to understand a bit more about what's driving this use case in your applications:
Now about your last question: adding |
Enzo Bonggio commented Thanks a lot for the response Brian Clozel, You can close this now |
Brian Clozel commented Thanks Enzo Bonggio, Just note that if you're confused about Spring MVC vs. Spring WebFlux, you can learn more about the runtime model differences and pros/cons in this talk. |
Andreas Schilling commented As I was also following the discussion on gitter I just want to make a small addition. |
Rossen Stoyanchev commented Andreas Schilling thanks for the extra comment. It's true we don't support |
Andreas Schilling commented Sure thing! I put it on my TODO list for tomorrow. |
Andreas Schilling commented And here we go: #21109 |
Enzo Bonggio opened SPR-16554 and commented
I have a project that I want to migrate from Tomcat to Netty but I found that one particular error is not being catch by my ControllerAdvice class.
To reproduce the problem:
At this point I expect that the ExceptionHandler catch Method Not Allowed exception and return my Complex object but is not happening. I don't understand also why this is working as expected if I add compile('org.springframework.boot:spring-boot-starter-web') to the project.
Reference URL: https://gist.github.com/enzobonggio/8807cfc7e63c73c38fad9018a5c76702
Issue Links:
@ResponseStatus-annotated
exceptions on WebFlux0 votes, 5 watchers
The text was updated successfully, but these errors were encountered: