public class EventListenerMethodProcessor extends java.lang.Object implements SmartInitializingSingleton, ApplicationContextAware, BeanFactoryPostProcessor
EventListener
methods as individual ApplicationListener
instances.
Implements BeanFactoryPostProcessor
(as of 5.1) primarily for early retrieval,
avoiding AOP checks for this processor bean and its EventListenerFactory
delegates.EventListenerFactory
,
DefaultEventListenerFactory
Modifier and Type | Field and Description |
---|---|
private ConfigurableApplicationContext |
applicationContext |
private ConfigurableListableBeanFactory |
beanFactory |
private EventExpressionEvaluator |
evaluator |
private java.util.List<EventListenerFactory> |
eventListenerFactories |
protected Log |
logger |
private java.util.Set<java.lang.Class<?>> |
nonAnnotatedClasses |
Constructor and Description |
---|
EventListenerMethodProcessor() |
Modifier and Type | Method and Description |
---|---|
void |
afterSingletonsInstantiated()
Invoked right at the end of the singleton pre-instantiation phase,
with a guarantee that all regular singleton beans have been created
already.
|
private static boolean |
isSpringContainerClass(java.lang.Class<?> clazz)
Determine whether the given class is an
org.springframework
bean class that is not annotated as a user or test Component ... |
void |
postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
Modify the application context's internal bean factory after its standard
initialization.
|
private void |
processBean(java.lang.String beanName,
java.lang.Class<?> targetType) |
void |
setApplicationContext(ApplicationContext applicationContext)
Set the ApplicationContext that this object runs in.
|
protected final Log logger
@Nullable private ConfigurableApplicationContext applicationContext
@Nullable private ConfigurableListableBeanFactory beanFactory
@Nullable private java.util.List<EventListenerFactory> eventListenerFactories
private final EventExpressionEvaluator evaluator
private final java.util.Set<java.lang.Class<?>> nonAnnotatedClasses
public void setApplicationContext(ApplicationContext applicationContext)
ApplicationContextAware
Invoked after population of normal bean properties but before an init callback such
as InitializingBean.afterPropertiesSet()
or a custom init-method. Invoked after ResourceLoaderAware.setResourceLoader(org.springframework.core.io.ResourceLoader)
,
ApplicationEventPublisherAware.setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher)
and
MessageSourceAware
, if applicable.
setApplicationContext
in interface ApplicationContextAware
applicationContext
- the ApplicationContext object to be used by this objectBeanInitializationException
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
BeanFactoryPostProcessor
postProcessBeanFactory
in interface BeanFactoryPostProcessor
beanFactory
- the bean factory used by the application contextpublic void afterSingletonsInstantiated()
SmartInitializingSingleton
ListableBeanFactory.getBeansOfType(java.lang.Class<T>)
calls within
this method won't trigger accidental side effects during bootstrap.
NOTE: This callback won't be triggered for singleton beans
lazily initialized on demand after BeanFactory
bootstrap,
and not for any other bean scope either. Carefully use it for beans
with the intended bootstrap semantics only.
afterSingletonsInstantiated
in interface SmartInitializingSingleton
private void processBean(java.lang.String beanName, java.lang.Class<?> targetType)
private static boolean isSpringContainerClass(java.lang.Class<?> clazz)
org.springframework
bean class that is not annotated as a user or test Component
...
which indicates that there is no EventListener
to be found there.