domi
domi

Reputation: 2257

does a reader for spring batch have to be an injected bean?

The transaction model in Spring batch is not so easy to understand, therefore I wonder where spring batch really needs to have proxies to fulfill all its work.

So does Spring need to create proxies around Readers, Writers, Processors and Steps and therefore I have to inject them as beans? or is it OK to no use injection for them?

Upvotes: 1

Views: 136

Answers (1)

Michael Minella
Michael Minella

Reputation: 21483

Spring only uses proxies within batch when you're using step scope. Otherwise, the beans are created and injected. With regards to not using injection for them, you can take that approach but there is a lot going on under the covers that you'd need to handle yourself so it's not recommended.

Upvotes: 1

Related Questions