Currently, using RestControllerAdvice ExceptionHandler with RestControllerEndpoint give the following result : 1. Webflux using same management port : ExceptionHandler take in account 2. Webflux using different management port : ExceptionHandler take in account 3. Mvc using same management port : ExceptionHandler take in account 4. Mvc using different management port : ExceptionHandler ignored
See tests in attached demo-exception-handler-rest-controller-endpoint.zip
It seems inconsistent to me.
spring-boot version : 2.6.7
Comment From: wilkinsona
Thanks very much for the minimal yet really comprehensive sample, @christophejan. I believe the difference in behaviour that you are seeing is because org.springframework.boot.actuate.autoconfigure.web.servlet.CompositeHandlerExceptionResolver does not consider a parent bean factory when finding HandlerExceptionResolver beans. We probably just need switch to using BeanFactoryUtils.beansOfTypeIncludingAncestors(ListableBeanFactory, Class<T>) instead but I'd like to check with the rest of the team first as my memory's a little hazy.
Comment From: wilkinsona
We're going to try switching to BeanFactoryUtils.beansOfTypeIncludingAncestors.
Comment From: philwebb
Closing in favor of PR #31495