This is a continuation of our series on exception handling and validation in Spring Boot REST APIs. In earlier posts, we discussed a robust pattern for exception handling and validation in Spring Boot and MVC REST Web Services. Please go through that first if you have not already. To summarize, we recommended coding an ErrorComposer
to compose errors from exception objects, which could be used in a controller advice as well as a custom error controller. The controller advice would catch exceptions bubbling up from your controllers, whereas the error controller would be the ultimate weapon for handling exceptions raised at all levels, e.g. in filters.
However, in WebFlux, Spring Boot provides a WebExceptionHandler
filter instead of the error controller. So, instead of providing your custom error controller and error attributes, you would need to provide a custom WebExceptionHandler and/or ErrorAttributes
. For more details, refer to Spring Boot documentation.
from DZone.com Feed https://ift.tt/2NV0WTN
No comments:
Post a Comment