Accelerate Your Spring Boot 3 Batch Development π
π―π΅ ζ₯ζ¬θͺη README γ― γγ‘γ.
- 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.
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:
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
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.
# Clone repository
git clone https://github.com/kinto-technologies/SpringBoot3BatchStarter.git
# Build and Run
./gradlew :skeletonBatch:bootRun
# 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"
.
βββ 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/
- Production-Ready Batch Framework:
- Pre-configured skeleton structure
- Ready for immediate development
- H2 in-memory database for simple setup
- DB to CSV Export:
- Dynamic query support
- Configurable data extraction
- CSV to DB Import:
- Bulk insert operations
- High-performance data loading
- 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
- Dynamic Configuration:
- Environment profiles (local/server)
- Runtime job configuration
- Customizable queries
- Development Support:
- Hot reload support
- Debug configuration
- IDE integration
- Code Quality:
- Google Java Format (Spotless)
- Static analysis (SpotBugs)
- Test coverage (Jacoco)
- CI Pipeline:
- GitHub Actions integration
- Automated testing
- Quality gates
- Cause: jOOQ auto-generation not executed
- Solution: Run
../gradlew generateJooq
- Alternative: Copy from
build/generated-src/jooq
tosrc/main/java
- Cause: MySQL container not running
- Solution: Run
docker compose up -d
- Verify: Check with
docker ps
- Symptom: "Job name must be specified" error
- Cause: Job name required when multiple jobs exist
- Solution: Add
--spring.batch.job.name=DB_TO_CSV
- Automated build and test
- Code formatting check
- Static analysis
- Coverage measurement
- Coverage visualization
- Automatic PR reports
- Change tracking
- Triggers on push/pull request
- Sets up MySQL container
- Configures JDK 21
- Runs Gradle build and tests
- Uploads coverage reports
- 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
Licensed under the Apache License 2.0.
Copyright Β© 2024 KINTO Technologies Corporation