Class EventListenerMethodProcessor
- java.lang.Object
- org.springframework.context.event.EventListenerMethodProcessor
- All Implemented Interfaces:
Aware
,SmartInitializingSingleton
,ApplicationContextAware
public class EventListenerMethodProcessor extends Object implements SmartInitializingSingleton, ApplicationContextAware
RegistersEventListener
methods as individualApplicationListener
instances.- Since:
- 4.2
- Author:
- Stephane Nicoll, Juergen Hoeller
Constructor Summary
Constructors Constructor Description EventListenerMethodProcessor()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.protected List<EventListenerFactory>
getEventListenerFactories()
Return theEventListenerFactory
instances to use to handleEventListener
annotated methods.protected void
processBean(List<EventListenerFactory> factories, String beanName, Class<?> targetType)
void
setApplicationContext(ApplicationContext applicationContext)
Set the ApplicationContext that this object runs in.
Constructor Detail
EventListenerMethodProcessor
public EventListenerMethodProcessor()
Method Detail
setApplicationContext
public void setApplicationContext(ApplicationContext applicationContext)
Description copied from interface:ApplicationContextAware
Set the ApplicationContext that this object runs in. Normally this call will be used to initialize the object.Invoked after population of normal bean properties but before an init callback such as
InitializingBean.afterPropertiesSet()
or a custom init-method. Invoked afterResourceLoaderAware.setResourceLoader(org.springframework.core.io.ResourceLoader)
,ApplicationEventPublisherAware.setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher)
andMessageSourceAware
, if applicable.- Specified by:
setApplicationContext
in interfaceApplicationContextAware
- Parameters:
applicationContext
- the ApplicationContext object to be used by this object- See Also:
BeanInitializationException
afterSingletonsInstantiated
public void afterSingletonsInstantiated()
Description copied from interface:SmartInitializingSingleton
Invoked right at the end of the singleton pre-instantiation phase, with a guarantee that all regular singleton beans have been created already.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.- Specified by:
afterSingletonsInstantiated
in interfaceSmartInitializingSingleton
getEventListenerFactories
protected List<EventListenerFactory> getEventListenerFactories()
Return theEventListenerFactory
instances to use to handleEventListener
annotated methods.
processBean
protected void processBean(List<EventListenerFactory> factories, String beanName, Class<?> targetType)