Package org.springframework.batch.core.configuration.annotation

# Annotation Interface StepScope

@Scope(value="step", proxyMode=TARGET_CLASS) @Retention(RUNTIME) @Documented public @interface StepScope

Convenient annotation for step scoped beans that defaults the proxy mode, so that it doesn't have to be specified explicitly on every bean definition. Use this on any @Bean that needs to inject @Values from the step context, and any bean that needs to share a lifecycle with a step execution (e.g. an ItemStream). E.g.

     @Bean
     @StepScope
     protected Callable<String> value(@Value("#{stepExecution.stepName}")
     final String value) {
            return new SimpleCallable(value);
     }

Marking a @Bean as @StepScope is equivalent to marking it as `@Scope(value="step", proxyMode=TARGET_CLASS)`

Since:
  2.2
Author:
  Dave Syer