rrezartprebreza/spring-boot-skills / skills/spring-boot-3/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 5 / Boot 3 builder API, restartability and idempotent job parameters, reader/writer thread-safety, fault tolerance, and chunk transaction boundaries.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 11.5 KB |
| agents/openai.yaml | config | 185 B |
| examples/bad-batch-config.java | other | 2.0 KB |
| examples/good-batch-config.java | other | 2.7 KB |
| templates/ChunkJobConfig.java | other | 2.4 KB |
| templates/JobScheduler.java | other | 1.5 KB |
templates/ChunkJobConfig.java
View on GitHub// Copy-paste starting point for a chunk-oriented Spring Batch 5 job (Spring Boot 3.x).
// Replace Order / OrderRow / the reader query and writer SQL with your domain.
// Do NOT add @EnableBatchProcessing — Boot auto-configures JobRepository + transaction manager.
@Configuration
@RequiredArgsConstructor
public class ChunkJobConfig {
private static final int CHUNK_SIZE = 500;
@Bean
public Job exampleJob(JobRepository jobRepository, Step exampleStep) {
return new JobBuilder("exampleJob", jobRepository)
.incrementer(new RunIdIncrementer())
.start(exampleStep)
.build();
}
@Bean
public Step exampleStep(JobRepository jobRepository,
PlatformTransactionManager txManager,
ItemReader<Order> reader,
ItemProcessor<Order, OrderRow> processor,
ItemWriter<OrderRow> writer) {
return new StepBuilder("exampleStep", jobRepository)
.<Order, OrderRow>chunk(CHUNK_SIZE, txManager)
.reader(reader)
.processor(processor)
.writer(writer)
.faultTolerant()
.retry(TransientDataAccessException.class).retryLimit(3) // retry transient failures
.skip(FlatFileParseException.class).skipLimit(50) // tolerate bad input rows
.build();
}
@Bean
@StepScope
public JpaPagingItemReader<Order> reader(
EntityManagerFactory emf,
@Value("#{jobParameters['status']}") String status) {
return new JpaPagingItemReaderBuilder<Order>()
.name("exampleReader")
.entityManagerFactory(emf)
.queryString("SELECT o FROM Order o WHERE o.status = :status ORDER BY o.id") // unique sort key
.parameterValues(Map.of("status", OrderStatus.valueOf(status)))
.pageSize(CHUNK_SIZE)
.build();
}
@Bean
public ItemProcessor<Order, OrderRow> processor() {
return OrderRow::from; // return null from a processor to FILTER an item out of the chunk
}
@Bean
public JdbcBatchItemWriter<OrderRow> writer(DataSource dataSource) {
return new JdbcBatchItemWriterBuilder<OrderRow>()
.dataSource(dataSource)
.sql("INSERT INTO order_export (id, total) VALUES (:id, :total)")
.beanMapped()
.build();
}
}
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 |