Class JobRegistryBeanPostProcessor
java.lang.Object
org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor
- All Implemented Interfaces:
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
@Deprecated(since="5.2")
public class JobRegistryBeanPostProcessor
extends Object
implements org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
Deprecated.
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.
An alternative to this class is JobRegistrySmartInitializingSingleton
, which is
recommended in cases where this class may cause early bean initializations. You must
include at most one of either of them as a bean.
- Author:
- Dave Syer, Mahmoud Ben Hassine
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Deprecated.Make sure the registry is set before use.void
destroy()
Deprecated.Unregister all theJob
instances that were registered by this post processor.protected String
getGroupName
(org.springframework.beans.factory.config.BeanDefinition beanDefinition, Job job) Deprecated.Determine a group name for the job to be registered.postProcessAfterInitialization
(Object bean, String beanName) Deprecated.If the bean is an instance ofJob
, then register it.postProcessBeforeInitialization
(Object bean, String beanName) Deprecated.Do nothing.void
setBeanFactory
(org.springframework.beans.factory.BeanFactory beanFactory) Deprecated.void
setGroupName
(String groupName) Deprecated.The group name for jobs registered by this component.void
setJobRegistry
(JobRegistry jobRegistry) Deprecated.Injection setter forJobRegistry
.
-
Constructor Details
-
JobRegistryBeanPostProcessor
public JobRegistryBeanPostProcessor()Deprecated.
-
-
Method Details
-
setGroupName
Deprecated.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 sameJobRegistry
: child contexts can then define an instance with a unique group name to avoid clashes between job names.- Parameters:
groupName
- the groupName to set
-
setJobRegistry
Deprecated.Injection setter forJobRegistry
.- Parameters:
jobRegistry
- the jobConfigurationRegistry to set
-
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException Deprecated.- Specified by:
setBeanFactory
in interfaceorg.springframework.beans.factory.BeanFactoryAware
- Throws:
org.springframework.beans.BeansException
-
afterPropertiesSet
Deprecated.Make sure the registry is set before use.- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
- See Also:
-
InitializingBean.afterPropertiesSet()
-
destroy
Deprecated.Unregister all theJob
instances that were registered by this post processor.- Specified by:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
- Throws:
Exception
- See Also:
-
DisposableBean.destroy()
-
postProcessAfterInitialization
public Object postProcessAfterInitialization(Object bean, String beanName) throws org.springframework.beans.BeansException Deprecated.If the bean is an instance ofJob
, then register it.- Specified by:
postProcessAfterInitialization
in interfaceorg.springframework.beans.factory.config.BeanPostProcessor
- Throws:
org.springframework.beans.FatalBeanException
- if there is aDuplicateJobException
.org.springframework.beans.BeansException
- See Also:
-
BeanPostProcessor.postProcessAfterInitialization(java.lang.Object, java.lang.String)
-
getGroupName
protected String getGroupName(org.springframework.beans.factory.config.BeanDefinition beanDefinition, Job job) Deprecated.Determine a group name for the job to be registered. The default implementation returns thegroupName
configured. Provides an extension point for specialised subclasses.- Parameters:
beanDefinition
- the bean definition for the jobjob
- the job- Returns:
- a group name for the job (or null if not needed)
-
postProcessBeforeInitialization
public Object postProcessBeforeInitialization(Object bean, String beanName) throws org.springframework.beans.BeansException Deprecated.Do nothing.- Specified by:
postProcessBeforeInitialization
in interfaceorg.springframework.beans.factory.config.BeanPostProcessor
- Throws:
org.springframework.beans.BeansException
- See Also:
-
BeanPostProcessor.postProcessBeforeInitialization(java.lang.Object, java.lang.String)
-
JobRegistrySmartInitializingSingleton
.