Package org.springframework.batch.core.scope

# 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`

Direct Known Subclasses:
  `JobScope`, `StepScope`

public abstract class BatchScopeSupport extends 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.

- ## Field Summary

  ### Fields inherited from interface org.springframework.core.Ordered

  `HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BatchScopeSupport()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected static org.springframework.beans.factory.config.BeanDefinitionHolder`
  `createScopedProxy(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 the `StepContext` is available.
  `String`
  `getName()`
  `int`
  `getOrder()`
  `abstract 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(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.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface org.springframework.beans.factory.config.Scope

  `get, getConversationId, registerDestructionCallback, remove, resolveContextualObject`

- ## Constructor Details

  - ### BatchScopeSupport

    public BatchScopeSupport()

- ## Method Details

  - ### setOrder

    public void setOrder(int order)
    Parameters:
      `order` - the order value to set priority of callback execution for the `BeanFactoryPostProcessor` part of this scope bean.

  - ### getOrder

    public int getOrder()
    Specified by:
      `getOrder` in interface `org.springframework.core.Ordered`

  - ### getName

    public String getName()

  - ### setName

    public void setName(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 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 interface `org.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(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 the `StepContext` is available. Amounts to adding <aop-auto-proxy/> to a step scoped bean.
    Parameters:
      `beanName` - the bean name to replace
      `definition` - the bean definition to replace
      `registry` - the enclosing `BeanDefinitionRegistry`
      `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.