Class BatchScopeSupport
- java.lang.Object
- org.springframework.batch.core.scope.BatchScopeSupport
- All Implemented Interfaces:
org.springframework.beans.factory.config.BeanFactoryPostProcessor
,org.springframework.beans.factory.config.Scope
,org.springframework.core.Ordered
public abstract class BatchScopeSupport extends java.lang.Object implements org.springframework.beans.factory.config.Scope, org.springframework.beans.factory.config.BeanFactoryPostProcessor, org.springframework.core.Ordered
ScopeSupport.- Since:
- 3.0
- Author:
- Michael Minella
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
BatchScopeSupport.Scopifier
Helper class to scan a bean definition hierarchy and force the use of auto-proxy for step scoped beans.
Constructor Summary
Constructors Constructor Description BatchScopeSupport()
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static org.springframework.beans.factory.config.BeanDefinitionHolder
createScopedProxy(java.lang.String beanName, org.springframework.beans.factory.config.BeanDefinition definition, org.springframework.beans.factory.support.BeanDefinitionRegistry registry, boolean proxyTargetClass)
Wrap a target bean definition in a proxy that defers initialization until after theStepContext
is available.java.lang.String
getName()
int
getOrder()
abstract java.lang.String
getTargetNamePrefix()
void
postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
Register this scope with the enclosing BeanFactory.void
setAutoProxy(boolean autoProxy)
Flag to indicate that bean definitions need not be auto proxied.void
setName(java.lang.String name)
Public setter for the name property.void
setOrder(int order)
void
setProxyTargetClass(boolean proxyTargetClass)
Flag to indicate that proxies should use dynamic subclassing.
Method Detail
setOrder
public void setOrder(int order)
- Parameters:
order
- the order value to set priority of callback execution for theBeanFactoryPostProcessor
part of this scope bean.
getOrder
public int getOrder()
- Specified by:
getOrder
in interfaceorg.springframework.core.Ordered
getName
public java.lang.String getName()
setName
public void setName(java.lang.String name)
Public setter for the name property. This can then be used as a bean definition attribute, e.g. scope="job".- Parameters:
name
- the name to set for this scope.
setProxyTargetClass
public void setProxyTargetClass(boolean proxyTargetClass)
Flag to indicate that proxies should use dynamic subclassing. This allows classes with no interface to be proxied. Defaults to false.- Parameters:
proxyTargetClass
- set to true to have proxies created using dynamic subclasses
setAutoProxy
public void setAutoProxy(boolean autoProxy)
Flag to indicate that bean definitions need not be auto proxied. This gives control back to the declarer of the bean definition (e.g. in an @Configuration class).- Parameters:
autoProxy
- the flag value to set (default true)
getTargetNamePrefix
public abstract java.lang.String getTargetNamePrefix()
postProcessBeanFactory
public void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) throws org.springframework.beans.BeansException
Register this scope with the enclosing BeanFactory.- Specified by:
postProcessBeanFactory
in interfaceorg.springframework.beans.factory.config.BeanFactoryPostProcessor
- Parameters:
beanFactory
- the BeanFactory to register with- Throws:
org.springframework.beans.BeansException
- if there is a problem.- See Also:
BeanFactoryPostProcessor.postProcessBeanFactory(ConfigurableListableBeanFactory)
createScopedProxy
protected static org.springframework.beans.factory.config.BeanDefinitionHolder createScopedProxy(java.lang.String beanName, org.springframework.beans.factory.config.BeanDefinition definition, org.springframework.beans.factory.support.BeanDefinitionRegistry registry, boolean proxyTargetClass)
Wrap a target bean definition in a proxy that defers initialization until after theStepContext
is available. Amounts to adding <aop-auto-proxy/> to a step scoped bean.- Parameters:
beanName
- the bean name to replacedefinition
- the bean definition to replaceregistry
- the enclosingBeanDefinitionRegistry
proxyTargetClass
- true if we need to force use of dynamic subclasses- Returns:
- a
BeanDefinitionHolder
for the new representation of the target. Caller should register it if needed to be visible at top level in bean factory.