-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
stripybadger opened SPR-11570 and commented
I use ContextLoaderListener
to load most of my spring stuff (lets call this context P), then have a DispatcherServlet
. Each DispatcherServlet
creates its own application context (lets call this D) which gets parented by P.
If I have beans in P which are controllers (annotated with @Controller
), they still get exposed by the DispatcherServlet
. However any ControllerAdvice
beans in P do not get picked up.
I think this inconsistency is a bug. Particularly as many users will want to be able to share controller advice beans between DispatcherServlet
(e.g. it may be useful to share exception handling across all servlets).
See AbstractDetectingUrlHandlerMapping:74 - calls BeanFactoryUtils.beanNamesForTypeIncludingAncestor
ControllerAdviceBean:92 - calls applicationContext.getBeanDefinitionNames() (which only appears to get beans from the current context, not parents)
Affects: 3.2.3