Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ItemStream not registered when using @StepScope in Java config [BATCH-2119] #1476

Closed
spring-issuemaster opened this issue Oct 8, 2013 · 3 comments

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Oct 8, 2013

Jean-Pierre Bergamin opened BATCH-2119 and commented

When setting up a step in java config with @StepScope, ItemStreams are not automatically registered.

When using this bean config:

@Bean
public ItemReader<ArchiveRecord> reader(@Value("#{jobParameters[warcsDir]}") String warcsDir) {
	return new ArchiveRecordReader(warcsDir);
}

The ArchiveRecordReader is registered as an ItemStream as expected.

Using @StepScope will not register the ArchiveRecordReader as an ItemStream any more (and it's open method will not be invoked).

@Bean
@StepScope
public ItemReader<ArchiveRecord> reader(@Value("#{jobParameters[warcsDir]}") String warcsDir) {
	return new ArchiveRecordReader(warcsDir);
}

This is the same behaviour as in BATCH-1218.


Affects: 2.2.2

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Oct 8, 2013

Jimmy Praet commented

You need to return ItemStreamReader instead of ItemReader to get the step scoped bean automatically registered as an item stream. See BATCH-2097

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Oct 9, 2013

Jean-Pierre Bergamin commented

Thanks that solved the issue.

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Oct 9, 2013

Michael Minella commented

Per issue BATCH-2097, we will add a note to the reference doc about this behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.