org.springframework.batch.core.scope

## Class StepScope

- java.lang.Object
- - org.springframework.batch.core.scope.BatchScopeSupport
  - - org.springframework.batch.core.scope.StepScope

- All Implemented Interfaces:
    org.springframework.beans.factory.config.BeanFactoryPostProcessor, org.springframework.beans.factory.config.Scope, org.springframework.core.Ordered

      public class StepScope
      extends BatchScopeSupport

  Scope for step context. Objects in this scope use the Spring container as an object factory, so there is only one instance of such a bean per executing step. All objects in this scope are <aop:scoped-proxy/> (no need to decorate the bean definitions).
  In addition, support is provided for late binding of references accessible from the `StepContext` using #{..} placeholders. Using this feature, bean properties can be pulled from the step or job execution context and the job parameters. E.g.

       <bean id="..." class="..." scope="step">
              <property name="parent" ref="#{stepExecutionContext[helper]}" />
       </bean>

       <bean id="..." class="..." scope="step">
              <property name="name" value="#{stepExecutionContext['input.name']}" />
       </bean>

       <bean id="..." class="..." scope="step">
              <property name="name" value="#{jobParameters[input]}" />
       </bean>

       <bean id="..." class="..." scope="step">
              <property name="name" value="#{jobExecutionContext['input.stem']}.txt" />
       </bean>

  The `StepContext` is referenced using standard bean property paths (as per `BeanWrapper`). The examples above all show the use of the Map accessors provided as a convenience for step and job attributes.
  Since:
    2.0
  Author:
    Dave Syer, Michael Minella

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.springframework.batch.core.scope.BatchScopeSupport

      `BatchScopeSupport.Scopifier`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `ID_KEY` Context key for clients to use for conversation identifier.

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

      `HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StepScope()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `get(java.lang.String name, org.springframework.beans.factory.ObjectFactory<?> objectFactory)`
    `java.lang.String` | `getConversationId()`
    `java.lang.String` | `getTargetNamePrefix()`
    `void` | `registerDestructionCallback(java.lang.String name, java.lang.Runnable callback)`
    `java.lang.Object` | `remove(java.lang.String name)`
    `java.lang.Object` | `resolveContextualObject(java.lang.String key)` This will be used to resolve expressions in step-scoped beans.

    - ### Methods inherited from class org.springframework.batch.core.scope.BatchScopeSupport

      `createScopedProxy, getName, getOrder, postProcessBeanFactory, setAutoProxy, setName, setOrder, setProxyTargetClass`

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

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

- - ### Field Detail

    - #### ID_KEY

          public static final java.lang.String ID_KEY

      Context key for clients to use for conversation identifier.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### StepScope

          public StepScope()

  - ### Method Detail

    - #### resolveContextualObject

          public java.lang.Object resolveContextualObject(java.lang.String key)

      This will be used to resolve expressions in step-scoped beans.

    - #### get

          public java.lang.Object get(java.lang.String name,
                                      org.springframework.beans.factory.ObjectFactory<?> objectFactory)

      See Also:
        `Scope.get(String, ObjectFactory)`

    - #### getConversationId

          public java.lang.String getConversationId()

      See Also:
        `Scope.getConversationId()`

    - #### registerDestructionCallback

          public void registerDestructionCallback(java.lang.String name,
                                                  java.lang.Runnable callback)

      See Also:
        `Scope.registerDestructionCallback(String, Runnable)`

    - #### remove

          public java.lang.Object remove(java.lang.String name)

      See Also:
        `Scope.remove(String)`

    - #### getTargetNamePrefix

          public java.lang.String getTargetNamePrefix()

      Specified by:
        `getTargetNamePrefix` in class `BatchScopeSupport`