
gittech. site
for different kinds of informations and explorations.
Spring Boot 3 Batch Starter Zero config tasklet jobs noJDK setup needed
Spring Batch 5 Starter
Accelerate Your Spring Boot 3 Batch Development π
π Language Support
π―π΅ ζ₯ζ¬θͺη README γ― γγ‘γ.
π Requirements
- JDK 21 (automatically downloaded by Gradle toolchain)
- Docker Desktop
- Gradle 8.5+ (not required if using gradlew)
π‘ This project uses JDK 21, but thanks to Gradle's toolchain feature, it will be automatically downloaded even if not installed locally.
π Overview
This comprehensive starter kit is designed specifically for Spring Boot 3 and Spring Batch 5, providing a production-ready foundation for enterprise batch processing applications. It offers two main components:
Skeleton Batch
A minimal, ready-to-use batch application where you can:
- Start development immediately by adding your business logic
- Focus on implementation without complex configuration
- Run in any environment with H2 in-memory database
DB and CSV Batch
A practical example implementing common batch operations:
- Export data from database to CSV with customizable queries
- Import CSV data to database with efficient bulk operations
- Demonstrate multi-database configuration best practices
Both components are built with industry best practices and utilize the latest Spring framework features to accelerate your batch development process.
π Quick Start Guide
1οΈβ£ Try Skeleton Batch
# Clone repository
git clone https://github.com/kinto-technologies/SpringBoot3BatchStarter.git
# Build and Run
./gradlew :skeletonBatch:bootRun
2οΈβ£ Try DB and CSV Batch
# Start MySQL container
docker compose up -d
# Run DB to CSV export
./gradlew :dbAndCsvBatch:bootRun --args="--spring.batch.job.name=DB_TO_CSV --spring.profiles.active=local"
# Run CSV to DB import
./gradlew :dbAndCsvBatch:bootRun --args="--spring.batch.job.name=CSV_TO_DB --spring.profiles.active=local"
π Project Structure
.
βββ gradlew # Gradle wrapper
βββ settings.gradle
βββ compose.yaml # Docker Compose configuration
βββ init-scripts # Database initialization
β βββ 1-create-table.sql
β βββ 2-insert-data.sql
βββ dbAndCsvBatch # DB-CSV batch project
β βββ README.md
β βββ build.gradle
β βββ src/
βββ skeletonBatch # Skeleton batch project
βββ README.md
βββ build.gradle
βββ src/
π‘ Core Features
ποΈ Foundation Components
- Production-Ready Batch Framework:
- Pre-configured skeleton structure
- Ready for immediate development
- H2 in-memory database for simple setup
π Data Operations
- DB to CSV Export:
- Dynamic query support
- Configurable data extraction
- CSV to DB Import:
- Bulk insert operations
- High-performance data loading
π οΈ Technical Stack
- Spring Integration:
- Spring Batch job/step management
- Type-safe SQL with jOOQ
- CSV processing with OpenCSV
- Dual Database Setup:
- H2 for batch metadata
- MySQL for business data
π» Development Tools
- Dynamic Configuration:
- Environment profiles (local/server)
- Runtime job configuration
- Customizable queries
- Development Support:
- Hot reload support
- Debug configuration
- IDE integration
π Quality Assurance
- Code Quality:
- Google Java Format (Spotless)
- Static analysis (SpotBugs)
- Test coverage (Jacoco)
- CI Pipeline:
- GitHub Actions integration
- Automated testing
- Quality gates
β Troubleshooting
Entity Classes Not Found
- Cause: jOOQ auto-generation not executed
- Solution: Run
../gradlew generateJooq
- Alternative: Copy from
build/generated-src/jooq
tosrc/main/java
Database Connection Error
- Cause: MySQL container not running
- Solution: Run
docker compose up -d
- Verify: Check with
docker ps
Multiple Jobs Error
- Symptom: "Job name must be specified" error
- Cause: Job name required when multiple jobs exist
- Solution: Add
--spring.batch.job.name=DB_TO_CSV
π Continuous Integration
GitHub Actions
- Automated build and test
- Code formatting check
- Static analysis
- Coverage measurement
Codecov
- Coverage visualization
- Automatic PR reports
- Change tracking
Workflow
- Triggers on push/pull request
- Sets up MySQL container
- Configures JDK 21
- Runs Gradle build and tests
- Uploads coverage reports
π Version Information
- Spring Boot: 3.4.1
- Spring Dependency Management: 1.1.7
- Spotless (Google Java Format): 6.22.0
- jOOQ: 9.0
- OpenCSV: 5.9
- SpotBugs: 6.0.27
π License
Licensed under the Apache License 2.0.
Copyright Β© 2024 KINTO Technologies Corporation