Annotation Interface StepScope


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

Convenient annotation for step-scoped beans. It defaults the proxy mode so that it need not be specified explicitly on every bean definition. Use this on any @Bean that needs to inject @Values from the step context and on any bean that needs to share a lifecycle with a step execution (such as an ItemStream). The following listing shows an example:

 @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, Taeik Lim