类 AbstractListenerFactoryBean<T>

  • 所有已实现的接口:
    org.springframework.beans.factory.FactoryBean<java.lang.Object>, org.springframework.beans.factory.InitializingBean
    直接已知子类:
    JobListenerFactoryBean, StepListenerFactoryBean

    public abstract class AbstractListenerFactoryBean<T>
    extends java.lang.Object
    implements org.springframework.beans.factory.FactoryBean<java.lang.Object>, org.springframework.beans.factory.InitializingBean
    FactoryBean implementation that builds a listener based on the various lifecycle methods or annotations that are provided. There are three possible ways of having a method called as part of a listener lifecycle:
    • Interface implementation: By implementing any of the subclasses of a listener interface, methods on said interface will be called
    • Annotations: Annotating a method will result in registration.
    • String name of the method to be called, which is tied to a ListenerMetaData value in the metaDataMap.
    It should be noted that methods obtained by name or annotation that don't match the listener method signatures to which they belong will cause errors. However, it is acceptable to have no parameters at all. If the same method is marked in more than one way. (i.e. the method name is given and it is annotated) the method will only be called once. However, if the same class has multiple methods tied to a particular listener, each method will be called. Also note that the same annotations cannot be applied to two separate methods in a single class.
    从以下版本开始:
    2.0
    作者:
    Lucas Ward, Dan Garrette
    另请参阅:
    ListenerMetaData
    • 方法详细资料

      • getObject

        public java.lang.Object getObject()
        指定者:
        getObject 在接口中 org.springframework.beans.factory.FactoryBean<T>
      • isSingleton

        public boolean isSingleton()
        指定者:
        isSingleton 在接口中 org.springframework.beans.factory.FactoryBean<T>
      • setDelegate

        public void setDelegate​(java.lang.Object delegate)
      • setMetaDataMap

        public void setMetaDataMap​(java.util.Map<java.lang.String,​java.lang.String> metaDataMap)
      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws java.lang.Exception
        指定者:
        afterPropertiesSet 在接口中 org.springframework.beans.factory.InitializingBean
        抛出:
        java.lang.Exception
      • isListener

        public static boolean isListener​(java.lang.Object target,
                                         java.lang.Class<?> listenerType,
                                         ListenerMetaData[] metaDataValues)
        Convenience method to check whether the given object is or can be made into a listener.
        参数:
        target - the object to check
        listenerType - the class of the listener.
        metaDataValues - array of ListenerMetaData.
        返回:
        true if the delegate is an instance of any of the listener interface, or contains the marker annotations