-
Notifications
You must be signed in to change notification settings - Fork 52
feat : Upgrade to spring boot 4 #2236
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
Changes from all commits
6f3773a
333751e
f32605b
d16f756
4a5d0f5
f3f80b5
56e01a0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,28 +7,25 @@ | |||||||||||||||||
| import java.util.concurrent.CopyOnWriteArrayList; | ||||||||||||||||||
| import java.util.concurrent.atomic.AtomicInteger; | ||||||||||||||||||
| import java.util.stream.Collectors; | ||||||||||||||||||
| import lombok.RequiredArgsConstructor; | ||||||||||||||||||
| import org.springframework.batch.core.JobParameters; | ||||||||||||||||||
| import org.springframework.batch.core.StepExecution; | ||||||||||||||||||
| import org.springframework.batch.core.annotation.BeforeStep; | ||||||||||||||||||
| import org.springframework.batch.item.database.AbstractPagingItemReader; | ||||||||||||||||||
| import org.springframework.batch.core.configuration.annotation.StepScope; | ||||||||||||||||||
| import org.springframework.batch.infrastructure.item.database.AbstractPagingItemReader; | ||||||||||||||||||
rajadilipkolli marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
| import org.springframework.beans.factory.annotation.Value; | ||||||||||||||||||
| import org.springframework.stereotype.Component; | ||||||||||||||||||
| import org.springframework.util.CollectionUtils; | ||||||||||||||||||
|
|
||||||||||||||||||
| @RequiredArgsConstructor | ||||||||||||||||||
| @Component | ||||||||||||||||||
| @StepScope | ||||||||||||||||||
| public class CustomItemReader<T> extends AbstractPagingItemReader<List<Long>> { | ||||||||||||||||||
|
|
||||||||||||||||||
| private final PostRepository postRepository; | ||||||||||||||||||
|
|
||||||||||||||||||
| private List<List<Long>> ids = new ArrayList<>(); | ||||||||||||||||||
|
|
||||||||||||||||||
| @Value("#{jobParameters['key']}") | ||||||||||||||||||
| private String titleValue; | ||||||||||||||||||
|
|
||||||||||||||||||
| @BeforeStep | ||||||||||||||||||
| public void beforeStep(final StepExecution stepExecution) { | ||||||||||||||||||
| JobParameters parameters = stepExecution.getJobExecution().getJobParameters(); | ||||||||||||||||||
| // use your parameters | ||||||||||||||||||
| this.titleValue = parameters.getString("key"); | ||||||||||||||||||
| public CustomItemReader(PostRepository postRepository) { | ||||||||||||||||||
| this.postRepository = postRepository; | ||||||||||||||||||
| } | ||||||||||||||||||
|
Comment on lines
+27
to
29
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Constructor must call Critical — missing
Moderate —
🐛 Proposed fix public CustomItemReader(PostRepository postRepository) {
+ setPageSize(1);
+ setName(ClassUtils.getShortName(CustomItemReader.class));
this.postRepository = postRepository;
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||
|
|
||||||||||||||||||
| @Override | ||||||||||||||||||
|
|
@@ -52,6 +49,10 @@ protected void doReadPage() { | |||||||||||||||||
| / getPageSize())) | ||||||||||||||||||
| .values()); | ||||||||||||||||||
| } | ||||||||||||||||||
| results.add(this.ids.get(getPage() * getPageSize())); | ||||||||||||||||||
| if (!CollectionUtils.isEmpty(ids)) { | ||||||||||||||||||
| if (getPage() < this.ids.size()) { | ||||||||||||||||||
| results.add(this.ids.get(getPage())); | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.