类 JobRegistryBeanPostProcessor

  • 所有已实现的接口:
    org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean

    public class JobRegistryBeanPostProcessor
    extends java.lang.Object
    implements org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
    A BeanPostProcessor that registers Job beans with a JobRegistry. Include a bean of this type along with your job configuration, and use the same JobRegistry as a JobLocator when you need to locate a Job to launch.
    作者:
    Dave Syer
    • 方法概要

      所有方法 实例方法 具体方法 
      修饰符和类型方法说明
      voidafterPropertiesSet()
      Make sure the registry is set before use.
      voiddestroy()
      Unregister all the Job instances that were registered by this post processor.
      protected java.lang.StringgetGroupName​(org.springframework.beans.factory.config.BeanDefinition beanDefinition, Job job)
      Determine a group name for the job to be registered.
      java.lang.ObjectpostProcessAfterInitialization​(java.lang.Object bean, java.lang.String beanName)
      If the bean is an instance of Job then register it.
      java.lang.ObjectpostProcessBeforeInitialization​(java.lang.Object bean, java.lang.String beanName)
      Do nothing.
      voidsetBeanFactory​(org.springframework.beans.factory.BeanFactory beanFactory) 
      voidsetGroupName​(java.lang.String groupName)
      The group name for jobs registered by this component.
      voidsetJobRegistry​(JobRegistry jobRegistry)
      Injection setter for JobRegistry.
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 方法详细资料

      • setGroupName

        public void setGroupName​(java.lang.String groupName)
        The group name for jobs registered by this component. Optional (defaults to null, which means that jobs are registered with their bean names). Useful where there is a hierarchy of application contexts all contributing to the same JobRegistry: child contexts can then define an instance with a unique group name to avoid clashes between job names.
        参数:
        groupName - the groupName to set
      • setBeanFactory

        public void setBeanFactory​(org.springframework.beans.factory.BeanFactory beanFactory)
                            throws org.springframework.beans.BeansException
        指定者:
        setBeanFactory 在接口中 org.springframework.beans.factory.BeanFactoryAware
        抛出:
        org.springframework.beans.BeansException
      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws java.lang.Exception
        Make sure the registry is set before use.
        指定者:
        afterPropertiesSet 在接口中 org.springframework.beans.factory.InitializingBean
        抛出:
        java.lang.Exception
        另请参阅:
        InitializingBean.afterPropertiesSet()
      • destroy

        public void destroy()
                     throws java.lang.Exception
        Unregister all the Job instances that were registered by this post processor.
        指定者:
        destroy 在接口中 org.springframework.beans.factory.DisposableBean
        抛出:
        java.lang.Exception
        另请参阅:
        DisposableBean.destroy()
      • postProcessAfterInitialization

        public java.lang.Object postProcessAfterInitialization​(java.lang.Object bean,
                                                               java.lang.String beanName)
                                                        throws org.springframework.beans.BeansException
        If the bean is an instance of Job then register it.
        指定者:
        postProcessAfterInitialization 在接口中 org.springframework.beans.factory.config.BeanPostProcessor
        抛出:
        org.springframework.beans.FatalBeanException - if there is a DuplicateJobException.
        org.springframework.beans.BeansException
        另请参阅:
        BeanPostProcessor.postProcessAfterInitialization(java.lang.Object, java.lang.String)
      • getGroupName

        protected java.lang.String getGroupName​(org.springframework.beans.factory.config.BeanDefinition beanDefinition,
                                                Job job)
        Determine a group name for the job to be registered. Default implementation just returns the groupName configured. Provides an extension point for specialised subclasses.
        参数:
        beanDefinition - the bean definition for the job
        job - the job
        返回:
        a group name for the job (or null if not needed)
      • postProcessBeforeInitialization

        public java.lang.Object postProcessBeforeInitialization​(java.lang.Object bean,
                                                                java.lang.String beanName)
                                                         throws org.springframework.beans.BeansException
        Do nothing.
        指定者:
        postProcessBeforeInitialization 在接口中 org.springframework.beans.factory.config.BeanPostProcessor
        抛出:
        org.springframework.beans.BeansException
        另请参阅:
        BeanPostProcessor.postProcessBeforeInitialization(java.lang.Object, java.lang.String)