rrezartprebreza/spring-boot-skills / skills/spring-boot-4/spring-batch
spring-batch
VerifiedUse when building batch jobs, ETL pipelines, scheduled imports/exports, or any chunk-oriented bulk processing with Spring Batch. Covers the Spring Batch 6 / Boot 4 builder API, resourceless vs JDBC job repositories, restartability and idempotent job parameters, reader/writer thread-safety, fault tolerance, and chunk transaction boundaries.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 14.3 KB |
| agents/openai.yaml | config | 185 B |
| examples/bad-batch-config.java | other | 2.4 KB |
| examples/good-batch-config.java | other | 2.9 KB |
| templates/ChunkJobConfig.java | other | 2.7 KB |
| templates/JobScheduler.java | other | 1.7 KB |
examples/bad-batch-config.java
View on GitHub// BAD — every line here is a Spring Batch 4/5 habit that breaks on Boot 4 / Batch 6,
// or a silent data-correctness bug.
@Configuration
@EnableBatchProcessing // BAD: this DISABLES Boot auto-config — JobRepository/JobOperator vanish
@RequiredArgsConstructor
public class OrderExportJobConfig {
private final JobBuilderFactory jobBuilderFactory; // BAD: removed in Batch 5 — won't compile
private final StepBuilderFactory stepBuilderFactory; // BAD: removed in Batch 5 — won't compile
private final JobLauncher jobLauncher; // BAD: consolidated into JobOperator in Batch 6
@Bean
public Job orderExportJob(Step exportStep) {
return jobBuilderFactory.get("orderExportJob") // BAD: factory API gone
.start(exportStep)
.build();
// BAD: no incrementer → re-running with same params throws JobInstanceAlreadyCompleteException
}
@Bean
public Step exportStep(PlatformTransactionManager txManager,
ItemReader<Order> reader,
ItemWriter<OrderRow> writer) {
return stepBuilderFactory.get("exportStep")
.<Order, OrderRow>chunk(500, txManager) // BAD: Batch 5 style — Batch 6: .chunk(500) + .transactionManager(txManager)
.reader(reader)
.writer(writer)
.build();
}
@Bean
public JdbcCursorItemReader<Order> reader(DataSource ds) { // BAD: cursor reader is NOT thread-safe
JdbcCursorItemReader<Order> r = new JdbcCursorItemReader<>();
r.setDataSource(ds);
r.setSql("SELECT id, total FROM orders WHERE status = 'PENDING'"); // BAD: no ORDER BY — pages drift
r.setRowMapper(new OrderRowMapper());
return r;
// BAD: not @StepScope, so it can't read jobParameters
}
@Bean
public ItemWriter<OrderRow> writer(EmailService email, OrderExportRepository repo) {
return items -> { // BAD: writer receives Chunk<>, not List<> (since Batch 5)
repo.saveAll(items);
email.send("export-done@co", "batch finished"); // BAD: inside chunk TX — fires even if chunk rolls back
};
}
// BAD: also: project only has spring-boot-starter-batch → resourceless in-memory repository,
// so the restart-on-failure this job relies on silently doesn't exist.
// Use spring-boot-starter-batch-jdbc for persistent BATCH_* metadata.
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |