Closed
Description
Piotr Findeisen opened SPR-13526 and commented
steps to reproduce
- Use
<context:annotation-config />
- this loads
EventListenerMethodProcessor
- this loads
- have a prototype bean "
A
" which uses@Transactional
and expects constructor arguments to be provided usingorg.springframework.beans.factory.BeanFactory.getBean(String, Object...)
- the bean doesn't need to use
@EventListener
- the bean doesn't need to use
- start the context
expected
- context starts
- if "
A
" is the only bean (or if nothing uses "A
"), the bean is not instantiated at all
observed
EventListenerMethodProcessor
wants to know whether "A
" is annotated with@EventListener
- it calls
applicationContext.getType("A")
applicationContext
(or ratherInfrastructureAdvisorAutoProxyCreator
) sees@Transactional
...- ... so sth like
A$$EnhancerBySpringCGLIB$$8e7e447
is returned
EventListenerMethodProcessor.getTargetClass
sees the bean class is kind ofSpringProxy
, so...- it instantiates the bean, but obviously not providing required arguments to constructor
- it calls
Affects: 4.2.1
Issue Links:
- EventListener in a Request scoped bean fails context initialization [SPR-13681] #18256 EventListener in a Request scoped bean fails context initialization
- Spring incorrectly interprets a bean to be a spring eventlistener [SPR-13538] #18114 Spring incorrectly interprets a bean to be a spring eventlistener
- EventListenerMethodProcessor resolves classes of lazy beans causing NoClassDefFoundError [SPR-13712] #17619 EventListenerMethodProcessor resolves classes of lazy beans causing NoClassDefFoundError
Referenced from: commits dbec212
1 votes, 5 watchers