类 JmsListenerAnnotationBeanPostProcessor
- java.lang.Object
- org.springframework.jms.annotation.JmsListenerAnnotationBeanPostProcessor
- 所有已实现的接口:
Aware
,BeanFactoryAware
,BeanPostProcessor
,SmartInitializingSingleton
,MergedBeanDefinitionPostProcessor
,Ordered
public class JmsListenerAnnotationBeanPostProcessor extends Object implements MergedBeanDefinitionPostProcessor, Ordered, BeanFactoryAware, SmartInitializingSingleton
Bean post-processor that registers methods annotated withJmsListener
to be invoked by a JMS message listener container created under the cover by aJmsListenerContainerFactory
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 theEnableJms
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 theEnableJms
javadocs for complete usage details.- 从以下版本开始:
- 4.1
- 作者:
- Stephane Nicoll, Juergen Hoeller
- 另请参阅:
JmsListener
,EnableJms
,JmsListenerConfigurer
,JmsListenerEndpointRegistrar
,JmsListenerEndpointRegistry
,JmsListenerEndpoint
,MethodJmsListenerEndpoint
字段概要
从接口继承的字段 org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
构造器概要
构造器 构造器 说明 JmsListenerAnnotationBeanPostProcessor()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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 MethodJmsListenerEndpoint
createMethodJmsListenerEndpoint()
Instantiate an emptyMethodJmsListenerEndpoint
for further configuration with provided parameters inprocessJmsListener(org.springframework.jms.annotation.JmsListener, java.lang.reflect.Method, java.lang.Object)
.int
getOrder()
Get the order value of this object.Object
postProcessAfterInitialization(Object bean, String beanName)
Apply thisBeanPostProcessor
to the given new bean instance after any bean initialization callbacks (like InitializingBean'safterPropertiesSet
or a custom init-method).Object
postProcessBeforeInitialization(Object bean, String beanName)
Apply thisBeanPostProcessor
to the given new bean instance before any bean initialization callbacks (like InitializingBean'safterPropertiesSet
or a custom init-method).void
postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class<?> beanType, String beanName)
Post-process the given merged bean definition for the specified bean.protected void
processJmsListener(JmsListener jmsListener, Method mostSpecificMethod, Object bean)
Process the givenJmsListener
annotation on the given method, registering a corresponding endpoint for the given bean instance.void
setBeanFactory(BeanFactory beanFactory)
Making aBeanFactory
available is optional; if not set,JmsListenerConfigurer
beans won't get autodetected and anendpoint registry
has to be explicitly configured.void
setContainerFactoryBeanName(String containerFactoryBeanName)
Set the name of theJmsListenerContainerFactory
to use by default.void
setEndpointRegistry(JmsListenerEndpointRegistry endpointRegistry)
Set theJmsListenerEndpointRegistry
that will hold the created endpoint and manage the lifecycle of the related listener container.void
setMessageHandlerMethodFactory(MessageHandlerMethodFactory messageHandlerMethodFactory)
Set theMessageHandlerMethodFactory
to use to configure the message listener responsible to serve an endpoint detected by this processor.从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor
resetBeanDefinition
构造器详细资料
JmsListenerAnnotationBeanPostProcessor
public JmsListenerAnnotationBeanPostProcessor()
方法详细资料
getOrder
public int getOrder()
从接口复制的说明:Ordered
Get the order value of this object.Higher values are interpreted as lower priority. As a consequence, the object with the lowest value has the highest priority (somewhat analogous to Servlet
load-on-startup
values).Same order values will result in arbitrary sort positions for the affected objects.
- 指定者:
getOrder
在接口中Ordered
- 返回:
- the order value
- 另请参阅:
Ordered.HIGHEST_PRECEDENCE
,Ordered.LOWEST_PRECEDENCE
setContainerFactoryBeanName
public void setContainerFactoryBeanName(String containerFactoryBeanName)
Set the name of theJmsListenerContainerFactory
to use by default.If none is specified, "jmsListenerContainerFactory" is assumed to be defined.
setEndpointRegistry
public void setEndpointRegistry(JmsListenerEndpointRegistry endpointRegistry)
Set theJmsListenerEndpointRegistry
that will hold the created endpoint and manage the lifecycle of the related listener container.
setMessageHandlerMethodFactory
public void setMessageHandlerMethodFactory(MessageHandlerMethodFactory messageHandlerMethodFactory)
Set theMessageHandlerMethodFactory
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. SeeDefaultMessageHandlerMethodFactory
Javadoc for more details.
setBeanFactory
public void setBeanFactory(BeanFactory beanFactory)
Making aBeanFactory
available is optional; if not set,JmsListenerConfigurer
beans won't get autodetected and anendpoint registry
has to be explicitly configured.- 指定者:
setBeanFactory
在接口中BeanFactoryAware
- 参数:
beanFactory
- owning BeanFactory (nevernull
). The bean can immediately call methods on the factory.- 另请参阅:
BeanInitializationException
afterSingletonsInstantiated
public void afterSingletonsInstantiated()
从接口复制的说明: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.
postProcessMergedBeanDefinition
public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class<?> beanType, String beanName)
从接口复制的说明:MergedBeanDefinitionPostProcessor
Post-process the given merged bean definition for the specified bean.- 指定者:
postProcessMergedBeanDefinition
在接口中MergedBeanDefinitionPostProcessor
- 参数:
beanDefinition
- the merged bean definition for the beanbeanType
- the actual type of the managed bean instancebeanName
- the name of the bean- 另请参阅:
AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(org.springframework.beans.factory.support.RootBeanDefinition, java.lang.Class<?>, java.lang.String)
postProcessBeforeInitialization
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException
从接口复制的说明:BeanPostProcessor
Apply thisBeanPostProcessor
to the given new bean instance before any bean initialization callbacks (like InitializingBean'safterPropertiesSet
or a custom init-method). The bean will already be populated with property values. The returned bean instance may be a wrapper around the original.The default implementation returns the given
bean
as-is.- 指定者:
postProcessBeforeInitialization
在接口中BeanPostProcessor
- 参数:
bean
- the new bean instancebeanName
- the name of the bean- 返回:
- the bean instance to use, either the original or a wrapped one; if
null
, no subsequent BeanPostProcessors will be invoked - 抛出:
BeansException
- in case of errors- 另请参阅:
InitializingBean.afterPropertiesSet()
postProcessAfterInitialization
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException
从接口复制的说明:BeanPostProcessor
Apply thisBeanPostProcessor
to the given new bean instance after any bean initialization callbacks (like InitializingBean'safterPropertiesSet
or a custom init-method). The bean will already be populated with property values. The returned bean instance may be a wrapper around the original.In case of a FactoryBean, this callback will be invoked for both the FactoryBean instance and the objects created by the FactoryBean (as of Spring 2.0). The post-processor can decide whether to apply to either the FactoryBean or created objects or both through corresponding
bean instanceof FactoryBean
checks.This callback will also be invoked after a short-circuiting triggered by a
InstantiationAwareBeanPostProcessor.postProcessBeforeInstantiation(java.lang.Class<?>, java.lang.String)
method, in contrast to all otherBeanPostProcessor
callbacks.The default implementation returns the given
bean
as-is.- 指定者:
postProcessAfterInitialization
在接口中BeanPostProcessor
- 参数:
bean
- the new bean instancebeanName
- the name of the bean- 返回:
- the bean instance to use, either the original or a wrapped one; if
null
, no subsequent BeanPostProcessors will be invoked - 抛出:
BeansException
- in case of errors- 另请参阅:
InitializingBean.afterPropertiesSet()
,FactoryBean
processJmsListener
protected void processJmsListener(JmsListener jmsListener, Method mostSpecificMethod, Object bean)
Process the givenJmsListener
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 on- 另请参阅:
createMethodJmsListenerEndpoint()
,JmsListenerEndpointRegistrar.registerEndpoint(org.springframework.jms.config.JmsListenerEndpoint, org.springframework.jms.config.JmsListenerContainerFactory<?>)
createMethodJmsListenerEndpoint
protected MethodJmsListenerEndpoint createMethodJmsListenerEndpoint()
Instantiate an emptyMethodJmsListenerEndpoint
for further configuration with provided parameters inprocessJmsListener(org.springframework.jms.annotation.JmsListener, java.lang.reflect.Method, java.lang.Object)
.- 返回:
- a new
MethodJmsListenerEndpoint
or subclass thereof - 从以下版本开始:
- 4.1.9
- 另请参阅:
MethodJmsListenerEndpoint.createMessageListenerInstance()