Add parameter supplier support to spring batch readers #727
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In my use case of
MyBatisCursorItemReader
like below, I have to specify query parameters before the Spring Container is initialized, which works well at first.After a few iterations, the query parameters needs to be determined by a preceding step, which is after Spring Container initialized, and I didn't come up with any elegant solution. So I made a copy of source code of
MyBatisCursorItemReaderBuilder
&MyBatisCursorItemReader
in my project, and then made some changes to them as shown in this PR.The client code becomes
It works great so far, except that copying whole source of
MyBatisCursorItemReaderBuilder
&MyBatisCursorItemReader
is not elegant enough. I considered subclassing, but the private fields makes it rather difficult.Considering this is a very useful feature, at least for me, the changes are very small and simple, I was wondering if I could make a contribute. So I added the same feature to
MyBatisPagingItemReaderBuilder
&MyBatisPagingItemReader
and made some changes to unit tests for the feature. Then there is this PR.Thanks for you time for anyone review or read this PR.