Difference between Spring Batch StepScope class and annotation?

Viewed 115

Can someone explain what is the difference between the Spring Batch's:

StepScope Annotation

and

StepScope Class

Other than the fact one is an annotation another is a class.

What is the use of the StepScope class ?

I have an idea of what the StepScope annotation is used for but what is the use for the class ?

1 Answers

You should not use StepScope class, it is the implementation allowing the Spring container to handle lifetime of bean declared with Step scope (annotated with @StepScope). Basically the implementation will return the same bean inside a step and return a new instance for an other step.

Related