public class JmsListenerAnnotationBeanPostProcessor
extends java.lang.Object
implements org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor, org.springframework.core.Ordered, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.SmartInitializingSingleton
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.
JmsListener
,
EnableJms
,
JmsListenerConfigurer
,
JmsListenerEndpointRegistrar
,
JmsListenerEndpointRegistry
,
JmsListenerEndpoint
,
MethodJmsListenerEndpoint
Constructor and Description |
---|
JmsListenerAnnotationBeanPostProcessor() |
Modifier and Type | Method and Description |
---|---|
void |
afterSingletonsInstantiated() |
protected MethodJmsListenerEndpoint |
createMethodJmsListenerEndpoint()
Instantiate an empty
MethodJmsListenerEndpoint for further
configuration with provided parameters in processJmsListener(org.springframework.jms.annotation.JmsListener, java.lang.reflect.Method, java.lang.Object) . |
int |
getOrder() |
java.lang.Object |
postProcessAfterInitialization(java.lang.Object bean,
java.lang.String beanName) |
java.lang.Object |
postProcessBeforeInitialization(java.lang.Object bean,
java.lang.String beanName) |
void |
postProcessMergedBeanDefinition(org.springframework.beans.factory.support.RootBeanDefinition beanDefinition,
java.lang.Class<?> beanType,
java.lang.String beanName) |
protected void |
processJmsListener(JmsListener jmsListener,
java.lang.reflect.Method mostSpecificMethod,
java.lang.Object bean)
Process the given
JmsListener annotation on the given method,
registering a corresponding endpoint for the given bean instance. |
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
Making a
BeanFactory available is optional; if not set,
JmsListenerConfigurer beans won't get autodetected and an
endpoint registry has to be explicitly configured. |
void |
setContainerFactoryBeanName(java.lang.String containerFactoryBeanName)
Set the name of the
JmsListenerContainerFactory to use by default. |
void |
setEndpointRegistry(JmsListenerEndpointRegistry endpointRegistry)
Set the
JmsListenerEndpointRegistry that will hold the created
endpoint and manage the lifecycle of the related listener container. |
void |
setMessageHandlerMethodFactory(org.springframework.messaging.handler.annotation.support.MessageHandlerMethodFactory messageHandlerMethodFactory)
Set the
MessageHandlerMethodFactory to use to configure the message
listener responsible to serve an endpoint detected by this processor. |
protected final Log logger
public JmsListenerAnnotationBeanPostProcessor()
public int getOrder()
getOrder
in interface org.springframework.core.Ordered
public void setEndpointRegistry(JmsListenerEndpointRegistry endpointRegistry)
JmsListenerEndpointRegistry
that will hold the created
endpoint and manage the lifecycle of the related listener container.public void setContainerFactoryBeanName(java.lang.String containerFactoryBeanName)
JmsListenerContainerFactory
to use by default.
If none is specified, "jmsListenerContainerFactory" is assumed to be defined.
public void setMessageHandlerMethodFactory(org.springframework.messaging.handler.annotation.support.MessageHandlerMethodFactory messageHandlerMethodFactory)
MessageHandlerMethodFactory
to use to configure the message
listener responsible to serve an endpoint detected by this processor.
By default, DefaultMessageHandlerMethodFactory
is used and it
can be configured further to support additional method arguments
or to customize conversion and validation support. See
DefaultMessageHandlerMethodFactory
Javadoc for more details.
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
BeanFactory
available is optional; if not set,
JmsListenerConfigurer
beans won't get autodetected and an
endpoint registry
has to be explicitly configured.setBeanFactory
in interface org.springframework.beans.factory.BeanFactoryAware
public void afterSingletonsInstantiated()
afterSingletonsInstantiated
in interface org.springframework.beans.factory.SmartInitializingSingleton
public void postProcessMergedBeanDefinition(org.springframework.beans.factory.support.RootBeanDefinition beanDefinition, java.lang.Class<?> beanType, java.lang.String beanName)
postProcessMergedBeanDefinition
in interface org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor
public java.lang.Object postProcessBeforeInitialization(java.lang.Object bean, java.lang.String beanName) throws org.springframework.beans.BeansException
postProcessBeforeInitialization
in interface org.springframework.beans.factory.config.BeanPostProcessor
org.springframework.beans.BeansException
public java.lang.Object postProcessAfterInitialization(java.lang.Object bean, java.lang.String beanName) throws org.springframework.beans.BeansException
postProcessAfterInitialization
in interface org.springframework.beans.factory.config.BeanPostProcessor
org.springframework.beans.BeansException
protected void processJmsListener(JmsListener jmsListener, java.lang.reflect.Method mostSpecificMethod, java.lang.Object bean)
JmsListener
annotation on the given method,
registering a corresponding endpoint for the given bean instance.jmsListener
- the annotation to processmostSpecificMethod
- the annotated methodbean
- the instance to invoke the method oncreateMethodJmsListenerEndpoint()
,
JmsListenerEndpointRegistrar.registerEndpoint(org.springframework.jms.config.JmsListenerEndpoint, org.springframework.jms.config.JmsListenerContainerFactory<?>)
protected MethodJmsListenerEndpoint createMethodJmsListenerEndpoint()
MethodJmsListenerEndpoint
for further
configuration with provided parameters in processJmsListener(org.springframework.jms.annotation.JmsListener, java.lang.reflect.Method, java.lang.Object)
.MethodJmsListenerEndpoint
or subclass thereofMethodJmsListenerEndpoint.createMessageListenerInstance()