Using @Component and @StepScope Together in Java Spring Batch | HackerNoon
Briefly

Using both @Component and @StepScope annotations together is acceptable in a Spring application, but developers must be aware of the implications on bean lifecycle and proxy creation.
The @Component annotation enables a class to be a Spring-managed bean, while @StepScope ensures its lifecycle is tied to a specific step in a batch job, allowing for context-specific parameters.
While @Component typically denotes a singleton scope, @StepScope flips this by creating a new instance per step execution, which can lead to confusion if not carefully managed.
To avoid redundant behavior in Spring Batch, a clear understanding of both @Component and @StepScope is vital for creating efficient and bug-free applications.
Read at Hackernoon
[
|
]