Class JmsListenerAnnotationBeanPostProcessor
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.config.BeanPostProcessor,org.springframework.beans.factory.SmartInitializingSingleton,org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor,org.springframework.core.Ordered
JmsListener
to be invoked by a JMS message listener container created under the cover
by a JmsListenerContainerFactory
according to the attributes of the annotation.
Annotated methods can use flexible arguments as defined by JmsListener.
This post-processor is automatically registered by Spring's
<jms:annotation-driven> XML element, and also by the EnableJms
annotation.
Autodetects any JmsListenerConfigurer instances in the container,
allowing for customization of the registry to be used, the default container
factory or for fine-grained control over endpoints registration. See the
EnableJms javadocs for complete usage details.
- Since:
- 4.1
- Author:
- Stephane Nicoll, Juergen Hoeller
- See Also:
-
Field Summary
FieldsFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected MethodJmsListenerEndpointInstantiate an emptyMethodJmsListenerEndpointfor further configuration with provided parameters inprocessJmsListener(org.springframework.jms.annotation.JmsListener, java.lang.reflect.Method, java.lang.Object).intgetOrder()postProcessAfterInitialization(Object bean, String beanName) postProcessBeforeInitialization(Object bean, String beanName) voidpostProcessMergedBeanDefinition(org.springframework.beans.factory.support.RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) protected voidprocessJmsListener(JmsListener jmsListener, Method mostSpecificMethod, Object bean) Process the givenJmsListenerannotation on the given method, registering a corresponding endpoint for the given bean instance.voidsetBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) Making aBeanFactoryavailable is optional; if not set,JmsListenerConfigurerbeans won't get autodetected and anendpoint registryhas to be explicitly configured.voidsetContainerFactoryBeanName(String containerFactoryBeanName) Set the name of theJmsListenerContainerFactoryto use by default.voidsetEndpointRegistry(JmsListenerEndpointRegistry endpointRegistry) Set theJmsListenerEndpointRegistrythat will hold the created endpoint and manage the lifecycle of the related listener container.voidsetMessageHandlerMethodFactory(org.springframework.messaging.handler.annotation.support.MessageHandlerMethodFactory messageHandlerMethodFactory) Set theMessageHandlerMethodFactoryto use to configure the message listener responsible to serve an endpoint detected by this processor.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor
resetBeanDefinition
-
Field Details
-
logger
protected final org.apache.commons.logging.Log logger
-
-
Constructor Details
-
JmsListenerAnnotationBeanPostProcessor
public JmsListenerAnnotationBeanPostProcessor()
-
-
Method Details
-
getOrder
public int getOrder()- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-
setContainerFactoryBeanName
Set the name of theJmsListenerContainerFactoryto use by default.If none is specified, "jmsListenerContainerFactory" is assumed to be defined.
-
setEndpointRegistry
Set theJmsListenerEndpointRegistrythat will hold the created endpoint and manage the lifecycle of the related listener container. -
setMessageHandlerMethodFactory
public void setMessageHandlerMethodFactory(org.springframework.messaging.handler.annotation.support.MessageHandlerMethodFactory messageHandlerMethodFactory) Set theMessageHandlerMethodFactoryto use to configure the message listener responsible to serve an endpoint detected by this processor.By default,
DefaultMessageHandlerMethodFactoryis used and it can be configured further to support additional method arguments or to customize conversion and validation support. SeeDefaultMessageHandlerMethodFactoryJavadoc for more details. -
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) Making aBeanFactoryavailable is optional; if not set,JmsListenerConfigurerbeans won't get autodetected and anendpoint registryhas to be explicitly configured.- Specified by:
setBeanFactoryin interfaceorg.springframework.beans.factory.BeanFactoryAware
-
afterSingletonsInstantiated
public void afterSingletonsInstantiated()- Specified by:
afterSingletonsInstantiatedin interfaceorg.springframework.beans.factory.SmartInitializingSingleton
-
postProcessMergedBeanDefinition
public void postProcessMergedBeanDefinition(org.springframework.beans.factory.support.RootBeanDefinition beanDefinition, Class<?> beanType, String beanName) - Specified by:
postProcessMergedBeanDefinitionin interfaceorg.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor
-
postProcessBeforeInitialization
public Object postProcessBeforeInitialization(Object bean, String beanName) throws org.springframework.beans.BeansException - Specified by:
postProcessBeforeInitializationin interfaceorg.springframework.beans.factory.config.BeanPostProcessor- Throws:
org.springframework.beans.BeansException
-
postProcessAfterInitialization
public Object postProcessAfterInitialization(Object bean, String beanName) throws org.springframework.beans.BeansException - Specified by:
postProcessAfterInitializationin interfaceorg.springframework.beans.factory.config.BeanPostProcessor- Throws:
org.springframework.beans.BeansException
-
processJmsListener
Process the givenJmsListenerannotation on the given method, registering a corresponding endpoint for the given bean instance.- Parameters:
jmsListener- the annotation to processmostSpecificMethod- the annotated methodbean- the instance to invoke the method on- See Also:
-
createMethodJmsListenerEndpoint
Instantiate an emptyMethodJmsListenerEndpointfor further configuration with provided parameters inprocessJmsListener(org.springframework.jms.annotation.JmsListener, java.lang.reflect.Method, java.lang.Object).- Returns:
- a new
MethodJmsListenerEndpointor subclass thereof - Since:
- 4.1.9
- See Also:
-