Skip to content

Conversation

@igorcampos-dev
Copy link
Owner

@igorcampos-dev igorcampos-dev commented Nov 17, 2025

Summary by CodeRabbit

  • New Features
    • Added two Spring Batch example apps (DB-backed async and Excel-file async) with REST endpoints to start jobs and check status; container and runtime configs included.
  • CI
    • Added GitHub Actions workflows for build, integration tests, and health checks for both examples.
  • Documentation
    • Added READMEs and updated project listing entries for both examples.
  • Tests
    • Added extensive unit and integration test suites covering controllers, services, mappers, and job flows.
  • Chores
    • Added modules, Maven wrappers, Dockerfiles, git/docker ignore and env configurations.

…dules, add application configuration, integration tests, and utility methods for batch processing
@coderabbitai
Copy link

coderabbitai bot commented Nov 17, 2025

Walkthrough

Adds two new Spring Batch example modules (spring-batch-db-examples, spring-batch-file-examples), registers them in the root POM and README, and introduces module scaffolding, full application code, configs, tests, Docker/compose assets, Maven wrappers, and CI workflows.

Changes

Cohort / File(s) Summary
Top-level CI workflows
​.github/workflows/spring-batch-db-example.yml, ​.github/workflows/spring-batch-file-example.yml
New PR-triggered GitHub Actions workflows per example: matrixed Java 21 builds (mvnw clean verify) and health-check jobs that start services from each module's compose.yaml and run container health checks.
Repository root
README.md, pom.xml
README updated with two new project entries; root Maven pom.xml adds spring-batch-db-examples and spring-batch-file-examples modules.
DB example: module scaffold & CI
spring-batch-db-examples/.dockerignore, spring-batch-db-examples/.gitattributes, spring-batch-db-examples/.gitignore, spring-batch-db-examples/.mvn/wrapper/maven-wrapper.properties, spring-batch-db-examples/mvnw, spring-batch-db-examples/mvnw.cmd, spring-batch-db-examples/.github/workflows/maven.yml, spring-batch-db-examples/pom.xml, spring-batch-db-examples/Dockerfile, spring-batch-db-examples/compose.yaml
New module scaffolding: Maven wrapper (3.3.4), CI workflow, multi-stage Dockerfile, docker-compose, ignore/gitattributes files, and module POM with Spring Boot/Batch, H2, and JaCoCo coverage checks.
DB example: application & domain
spring-batch-db-examples/src/main/java/... (e.g. DbReaderExampleApplication.java, config/BatchConfig.java, job/BatchJob.java, controller/TestController.java, service/**, mapper/**, model/**, repository/**, exception/**, listener/**, init/Init.java)
New Spring Boot app and domain: async Spring Batch configuration, Job bean, REST controller, DBBatchService/TestService and implementations, TestEntity/TestDto, mapper, JPA repository, global exception handler, logging listener, and startup data initializer.
DB example: resources & tests
spring-batch-db-examples/src/main/resources/*, spring-batch-db-examples/src/test/java/..., spring-batch-db-examples/src/test/resources/application-test.yml
Added application.yml/application-prd.yml/banner, test resources, and comprehensive unit/integration tests (controllers, services, mapper, init, job integration) plus test utilities.
File example: module scaffold & CI
spring-batch-file-examples/.dockerignore, spring-batch-file-examples/.gitattributes, spring-batch-file-examples/.gitignore, spring-batch-file-examples/.mvn/wrapper/maven-wrapper.properties, spring-batch-file-examples/mvnw, spring-batch-file-examples/mvnw.cmd, spring-batch-file-examples/.github/workflows/maven.yml, spring-batch-file-examples/pom.xml, spring-batch-file-examples/Dockerfile, spring-batch-file-examples/compose.yaml
New module scaffold mirroring DB example: Maven wrapper, CI build workflow, Dockerfile, docker-compose, ignore/gitattributes, and module POM (includes POI / spring-batch-excel).
File example: application & domain
spring-batch-file-examples/src/main/java/... (e.g. FileReaderExampleApplication.java, config/ExcelBatchConfig.java, job/FileJob.java, controller/TestController.java, service/**, mapper/StudentMapper.java, dto/StudentDto.java, exception/**)
New Spring Boot app and Excel-based batch configuration (PoiItemReader), Job bean, REST controller, FileBatchService and implementation, StudentDto/mapper, global exception handler, service impl, and module README/banner.
File example: resources & tests
spring-batch-file-examples/src/main/resources/*, spring-batch-file-examples/src/test/java/..., spring-batch-file-examples/src/test/resources/application-test.yml
Added application.yml/application-prd.yml/banner, test resources, and unit/integration tests for controller, services, mappers, Excel job integration, and test utilities.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Files/areas needing extra attention:
    • mvnw and mvnw.cmd scripts (download/extract, checksum, platform-specific logic).
    • Async batch wiring and thread-pool configuration in BatchConfig.java and ExcelBatchConfig.java.
    • Docker Compose health-check workflow steps that parse service names from compose.yaml.
    • JaCoCo coverage check configuration and enforcement in both module POMs.

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'Feature/spring batch examples' is vague and uses a generic naming pattern (Feature/...) that doesn't clearly convey the specific changes being introduced. Consider using a more descriptive title that clarifies the main addition, such as 'Add Spring Batch database and file examples' or 'Introduce Spring Batch example projects with CI workflows'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/spring-batch-examples

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 41

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fb1ff31 and 2aa5f20.

⛔ Files ignored due to path filters (4)
  • spring-batch-file-examples/src/main/resources/files/students.xlsx is excluded by !**/*.xlsx
  • spring-batch-file-examples/src/test/resources/files/students-empty.xlsx is excluded by !**/*.xlsx
  • spring-batch-file-examples/src/test/resources/files/students-error.xlsx is excluded by !**/*.xlsx
  • spring-batch-file-examples/src/test/resources/files/students.xlsx is excluded by !**/*.xlsx
📒 Files selected for processing (78)
  • .github/workflows/spring-batch-db-example.yml (1 hunks)
  • .github/workflows/spring-batch-file-example.yml (1 hunks)
  • README.md (1 hunks)
  • pom.xml (1 hunks)
  • spring-batch-db-examples/.dockerignore (1 hunks)
  • spring-batch-db-examples/.gitattributes (1 hunks)
  • spring-batch-db-examples/.github/workflows/maven.yml (1 hunks)
  • spring-batch-db-examples/.gitignore (1 hunks)
  • spring-batch-db-examples/.mvn/wrapper/maven-wrapper.properties (1 hunks)
  • spring-batch-db-examples/Dockerfile (1 hunks)
  • spring-batch-db-examples/README.md (1 hunks)
  • spring-batch-db-examples/compose.yaml (1 hunks)
  • spring-batch-db-examples/mvnw (1 hunks)
  • spring-batch-db-examples/mvnw.cmd (1 hunks)
  • spring-batch-db-examples/pom.xml (1 hunks)
  • spring-batch-db-examples/src/main/java/com/io/example/DbReaderExampleApplication.java (1 hunks)
  • spring-batch-db-examples/src/main/java/com/io/example/config/BatchConfig.java (1 hunks)
  • spring-batch-db-examples/src/main/java/com/io/example/controller/TestController.java (1 hunks)
  • spring-batch-db-examples/src/main/java/com/io/example/exception/BusinessException.java (1 hunks)
  • spring-batch-db-examples/src/main/java/com/io/example/exception/GlobalHandlerException.java (1 hunks)
  • spring-batch-db-examples/src/main/java/com/io/example/init/Init.java (1 hunks)
  • spring-batch-db-examples/src/main/java/com/io/example/job/BatchJob.java (1 hunks)
  • spring-batch-db-examples/src/main/java/com/io/example/listener/LoggingStepListener.java (1 hunks)
  • spring-batch-db-examples/src/main/java/com/io/example/mapper/TestEntityMapper.java (1 hunks)
  • spring-batch-db-examples/src/main/java/com/io/example/model/dto/TestDto.java (1 hunks)
  • spring-batch-db-examples/src/main/java/com/io/example/model/entity/TestEntity.java (1 hunks)
  • spring-batch-db-examples/src/main/java/com/io/example/repository/TestEntityRepository.java (1 hunks)
  • spring-batch-db-examples/src/main/java/com/io/example/repository/query/TestEntityQuery.java (1 hunks)
  • spring-batch-db-examples/src/main/java/com/io/example/service/DBBatchService.java (1 hunks)
  • spring-batch-db-examples/src/main/java/com/io/example/service/TestService.java (1 hunks)
  • spring-batch-db-examples/src/main/java/com/io/example/service/impl/DBBatchServiceImpl.java (1 hunks)
  • spring-batch-db-examples/src/main/java/com/io/example/service/impl/TestServiceImpl.java (1 hunks)
  • spring-batch-db-examples/src/main/resources/application-prd.yml (1 hunks)
  • spring-batch-db-examples/src/main/resources/application.yml (1 hunks)
  • spring-batch-db-examples/src/main/resources/banner.txt (1 hunks)
  • spring-batch-db-examples/src/test/java/com/io/example/controller/TestControllerTest.java (1 hunks)
  • spring-batch-db-examples/src/test/java/com/io/example/init/InitIntegrationTest.java (1 hunks)
  • spring-batch-db-examples/src/test/java/com/io/example/job/BatchJobIntegrationTest.java (1 hunks)
  • spring-batch-db-examples/src/test/java/com/io/example/mapper/TestEntityMapperTest.java (1 hunks)
  • spring-batch-db-examples/src/test/java/com/io/example/service/DBBatchServiceImplTest.java (1 hunks)
  • spring-batch-db-examples/src/test/java/com/io/example/service/TestServiceImplTest.java (1 hunks)
  • spring-batch-db-examples/src/test/java/com/io/example/util/DataUtils.java (1 hunks)
  • spring-batch-db-examples/src/test/resources/application-test.yml (1 hunks)
  • spring-batch-file-examples/.dockerignore (1 hunks)
  • spring-batch-file-examples/.gitattributes (1 hunks)
  • spring-batch-file-examples/.github/workflows/maven.yml (1 hunks)
  • spring-batch-file-examples/.gitignore (1 hunks)
  • spring-batch-file-examples/.mvn/wrapper/maven-wrapper.properties (1 hunks)
  • spring-batch-file-examples/Dockerfile (1 hunks)
  • spring-batch-file-examples/README.md (1 hunks)
  • spring-batch-file-examples/compose.yaml (1 hunks)
  • spring-batch-file-examples/mvnw (1 hunks)
  • spring-batch-file-examples/mvnw.cmd (1 hunks)
  • spring-batch-file-examples/pom.xml (1 hunks)
  • spring-batch-file-examples/src/main/java/com/io/example/FileReaderExampleApplication.java (1 hunks)
  • spring-batch-file-examples/src/main/java/com/io/example/README.md (1 hunks)
  • spring-batch-file-examples/src/main/java/com/io/example/config/ExcelBatchConfig.java (1 hunks)
  • spring-batch-file-examples/src/main/java/com/io/example/controller/TestController.java (1 hunks)
  • spring-batch-file-examples/src/main/java/com/io/example/dto/StudentDto.java (1 hunks)
  • spring-batch-file-examples/src/main/java/com/io/example/exception/BusinessException.java (1 hunks)
  • spring-batch-file-examples/src/main/java/com/io/example/exception/GlobalHandlerException.java (1 hunks)
  • spring-batch-file-examples/src/main/java/com/io/example/job/FileJob.java (1 hunks)
  • spring-batch-file-examples/src/main/java/com/io/example/mapper/StudentMapper.java (1 hunks)
  • spring-batch-file-examples/src/main/java/com/io/example/service/FileBatchService.java (1 hunks)
  • spring-batch-file-examples/src/main/java/com/io/example/service/TestService.java (1 hunks)
  • spring-batch-file-examples/src/main/java/com/io/example/service/impl/FileBatchServiceImpl.java (1 hunks)
  • spring-batch-file-examples/src/main/java/com/io/example/service/impl/TestServiceImpl.java (1 hunks)
  • spring-batch-file-examples/src/main/resources/application-prd.yml (1 hunks)
  • spring-batch-file-examples/src/main/resources/application.yml (1 hunks)
  • spring-batch-file-examples/src/main/resources/banner.txt (1 hunks)
  • spring-batch-file-examples/src/test/java/com/io/example/FileReaderExampleApplicationTest.java (1 hunks)
  • spring-batch-file-examples/src/test/java/com/io/example/controller/TestControllerTest.java (1 hunks)
  • spring-batch-file-examples/src/test/java/com/io/example/job/BatchJobIntegrationTest.java (1 hunks)
  • spring-batch-file-examples/src/test/java/com/io/example/mapper/StudentMapperTest.java (1 hunks)
  • spring-batch-file-examples/src/test/java/com/io/example/service/FileBatchServiceImplTest.java (1 hunks)
  • spring-batch-file-examples/src/test/java/com/io/example/service/TestServiceImplTest.java (1 hunks)
  • spring-batch-file-examples/src/test/java/com/io/example/util/DataUtils.java (1 hunks)
  • spring-batch-file-examples/src/test/resources/application-test.yml (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: igorcampos-dev
Repo: igorcampos-dev/spring-integrations-examples PR: 40
File: spring-kafka-example/src/main/java/com/io/example/consumer/KafkaConsumerServiceImpl.java:18-22
Timestamp: 2025-07-27T19:57:31.204Z
Learning: In the spring-integrations-examples project, user igorcampos-dev prefers to keep simple example implementations minimal without additional error handling complexity, as the examples are for demonstration purposes rather than production use.
Learnt from: igorcampos-dev
Repo: igorcampos-dev/spring-integrations-examples PR: 40
File: spring-kafka-example/src/main/java/com/io/example/consumer/KafkaConsumerService.java:3-3
Timestamp: 2025-07-27T19:51:52.736Z
Learning: In the spring-integrations-examples project, user igorcampos-dev uses SuppressWarnings("unused") annotations to suppress IntelliJ IDEA alerts, and these annotations should not be suggested for removal as they serve a specific purpose in their development workflow.
Learnt from: igorcampos-dev
Repo: igorcampos-dev/spring-integrations-examples PR: 21
File: spring-kafka-example/README.md:12-17
Timestamp: 2025-07-22T01:35:41.406Z
Learning: User igorcampos-dev prefers minimal, high-level documentation in README files without detailed version specifications, choosing to keep tech stack information simple rather than adding precise version numbers.
Learnt from: igorcampos-dev
Repo: igorcampos-dev/spring-integrations-examples PR: 21
File: spring-kafka-example/compose.yaml:30-32
Timestamp: 2025-07-22T01:30:57.054Z
Learning: User igorcampos-dev prefers to maintain environment parity between local development and production, avoiding development-specific configurations like ALLOW_PLAINTEXT_LISTENER even when they might provide clearer intent or safety nets.
Learnt from: igorcampos-dev
Repo: igorcampos-dev/spring-integrations-examples PR: 26
File: spring-kafka-example/compose.yaml:3-4
Timestamp: 2025-07-24T01:40:49.337Z
Learning: User igorcampos-dev requires hard-coded container names in Docker Compose files (like `container_name: app`) for CI pipeline validation purposes, which is a valid operational requirement that overrides the general best practice of avoiding hard-coded container names.
📚 Learning: 2025-07-27T19:57:31.204Z
Learnt from: igorcampos-dev
Repo: igorcampos-dev/spring-integrations-examples PR: 40
File: spring-kafka-example/src/main/java/com/io/example/consumer/KafkaConsumerServiceImpl.java:18-22
Timestamp: 2025-07-27T19:57:31.204Z
Learning: In the spring-integrations-examples project, user igorcampos-dev prefers to keep simple example implementations minimal without additional error handling complexity, as the examples are for demonstration purposes rather than production use.

Applied to files:

  • spring-batch-db-examples/src/main/resources/banner.txt
  • README.md
  • spring-batch-file-examples/.gitignore
  • spring-batch-file-examples/src/main/resources/banner.txt
  • spring-batch-file-examples/src/main/java/com/io/example/README.md
  • spring-batch-file-examples/pom.xml
  • spring-batch-db-examples/pom.xml
📚 Learning: 2025-07-27T19:51:52.736Z
Learnt from: igorcampos-dev
Repo: igorcampos-dev/spring-integrations-examples PR: 40
File: spring-kafka-example/src/main/java/com/io/example/consumer/KafkaConsumerService.java:3-3
Timestamp: 2025-07-27T19:51:52.736Z
Learning: In the spring-integrations-examples project, user igorcampos-dev uses SuppressWarnings("unused") annotations to suppress IntelliJ IDEA alerts, and these annotations should not be suggested for removal as they serve a specific purpose in their development workflow.

Applied to files:

  • spring-batch-db-examples/.dockerignore
  • spring-batch-file-examples/.gitignore
  • spring-batch-db-examples/.gitignore
🧬 Code graph analysis (30)
spring-batch-db-examples/src/main/java/com/io/example/model/entity/TestEntity.java (1)
spring-batch-db-examples/src/main/java/com/io/example/model/dto/TestDto.java (1)
  • Data (8-21)
spring-batch-file-examples/src/main/java/com/io/example/service/impl/TestServiceImpl.java (1)
spring-batch-db-examples/src/main/java/com/io/example/service/impl/TestServiceImpl.java (1)
  • Slf4j (8-17)
spring-batch-db-examples/src/main/java/com/io/example/exception/GlobalHandlerException.java (2)
spring-batch-db-examples/src/main/java/com/io/example/service/impl/DBBatchServiceImpl.java (1)
  • Slf4j (12-51)
spring-batch-file-examples/src/main/java/com/io/example/exception/GlobalHandlerException.java (1)
  • Slf4j (9-19)
spring-batch-db-examples/src/test/java/com/io/example/service/TestServiceImplTest.java (1)
spring-batch-file-examples/src/test/java/com/io/example/service/TestServiceImplTest.java (1)
  • TestServiceImplTest (8-18)
spring-batch-file-examples/src/main/java/com/io/example/exception/BusinessException.java (1)
spring-batch-db-examples/src/main/java/com/io/example/exception/BusinessException.java (1)
  • BusinessException (3-13)
spring-batch-file-examples/src/main/java/com/io/example/controller/TestController.java (1)
spring-batch-db-examples/src/main/java/com/io/example/controller/TestController.java (1)
  • RestController (15-39)
spring-batch-file-examples/src/main/java/com/io/example/job/FileJob.java (1)
spring-batch-db-examples/src/main/java/com/io/example/job/BatchJob.java (1)
  • Component (11-22)
spring-batch-db-examples/src/test/java/com/io/example/controller/TestControllerTest.java (2)
spring-batch-db-examples/src/main/java/com/io/example/exception/BusinessException.java (1)
  • BusinessException (3-13)
spring-batch-file-examples/src/test/java/com/io/example/controller/TestControllerTest.java (1)
  • WebMvcTest (24-74)
spring-batch-file-examples/src/test/java/com/io/example/job/BatchJobIntegrationTest.java (2)
spring-batch-db-examples/src/test/java/com/io/example/job/BatchJobIntegrationTest.java (1)
  • SpringBootTest (25-86)
spring-batch-file-examples/src/test/java/com/io/example/util/DataUtils.java (1)
  • DataUtils (6-15)
spring-batch-file-examples/src/main/java/com/io/example/config/ExcelBatchConfig.java (2)
spring-batch-file-examples/src/main/java/com/io/example/mapper/StudentMapper.java (1)
  • StudentMapper (9-21)
spring-batch-db-examples/src/main/java/com/io/example/config/BatchConfig.java (1)
  • Configuration (37-124)
spring-batch-db-examples/src/test/java/com/io/example/util/DataUtils.java (1)
spring-batch-file-examples/src/test/java/com/io/example/util/DataUtils.java (1)
  • DataUtils (6-15)
spring-batch-db-examples/src/main/java/com/io/example/service/impl/DBBatchServiceImpl.java (2)
spring-batch-db-examples/src/main/java/com/io/example/exception/BusinessException.java (1)
  • BusinessException (3-13)
spring-batch-file-examples/src/main/java/com/io/example/service/impl/FileBatchServiceImpl.java (1)
  • Slf4j (12-52)
spring-batch-file-examples/src/test/java/com/io/example/FileReaderExampleApplicationTest.java (1)
spring-batch-file-examples/src/test/java/com/io/example/job/BatchJobIntegrationTest.java (1)
  • SpringBootTest (22-76)
spring-batch-file-examples/src/main/java/com/io/example/service/impl/FileBatchServiceImpl.java (3)
spring-batch-file-examples/src/main/java/com/io/example/exception/BusinessException.java (1)
  • BusinessException (3-13)
spring-batch-db-examples/src/main/java/com/io/example/service/impl/DBBatchServiceImpl.java (1)
  • Slf4j (12-51)
spring-batch-file-examples/src/main/java/com/io/example/exception/GlobalHandlerException.java (1)
  • Slf4j (9-19)
spring-batch-db-examples/src/main/java/com/io/example/controller/TestController.java (2)
spring-batch-db-examples/src/main/java/com/io/example/exception/BusinessException.java (1)
  • BusinessException (3-13)
spring-batch-file-examples/src/main/java/com/io/example/controller/TestController.java (1)
  • RestController (12-31)
spring-batch-file-examples/src/test/java/com/io/example/service/TestServiceImplTest.java (1)
spring-batch-db-examples/src/test/java/com/io/example/service/TestServiceImplTest.java (1)
  • TestServiceImplTest (8-18)
spring-batch-file-examples/src/main/java/com/io/example/dto/StudentDto.java (1)
spring-batch-db-examples/src/main/java/com/io/example/model/dto/TestDto.java (1)
  • Data (8-21)
spring-batch-file-examples/src/test/java/com/io/example/service/FileBatchServiceImplTest.java (2)
spring-batch-file-examples/src/main/java/com/io/example/exception/BusinessException.java (1)
  • BusinessException (3-13)
spring-batch-db-examples/src/test/java/com/io/example/service/DBBatchServiceImplTest.java (1)
  • ExtendWith (23-93)
spring-batch-db-examples/src/main/java/com/io/example/service/impl/TestServiceImpl.java (1)
spring-batch-file-examples/src/main/java/com/io/example/service/impl/TestServiceImpl.java (1)
  • Slf4j (8-17)
spring-batch-db-examples/src/test/java/com/io/example/job/BatchJobIntegrationTest.java (1)
spring-batch-db-examples/src/test/java/com/io/example/util/DataUtils.java (1)
  • DataUtils (12-35)
spring-batch-db-examples/src/main/java/com/io/example/config/BatchConfig.java (3)
spring-batch-db-examples/src/main/java/com/io/example/mapper/TestEntityMapper.java (1)
  • TestEntityMapper (7-21)
spring-batch-db-examples/src/main/java/com/io/example/repository/query/TestEntityQuery.java (1)
  • RequiredArgsConstructor (6-27)
spring-batch-file-examples/src/main/java/com/io/example/config/ExcelBatchConfig.java (1)
  • Configuration (28-91)
spring-batch-db-examples/src/main/java/com/io/example/job/BatchJob.java (1)
spring-batch-file-examples/src/main/java/com/io/example/job/FileJob.java (1)
  • Component (11-22)
spring-batch-file-examples/src/main/java/com/io/example/FileReaderExampleApplication.java (1)
spring-batch-db-examples/src/main/java/com/io/example/DbReaderExampleApplication.java (1)
  • SpringBootApplication (6-13)
spring-batch-db-examples/src/main/java/com/io/example/model/dto/TestDto.java (1)
spring-batch-db-examples/src/main/java/com/io/example/model/entity/TestEntity.java (1)
  • Data (9-27)
spring-batch-db-examples/src/main/java/com/io/example/exception/BusinessException.java (1)
spring-batch-file-examples/src/main/java/com/io/example/exception/BusinessException.java (1)
  • BusinessException (3-13)
spring-batch-file-examples/src/test/java/com/io/example/util/DataUtils.java (1)
spring-batch-db-examples/src/test/java/com/io/example/util/DataUtils.java (1)
  • DataUtils (12-35)
spring-batch-db-examples/src/main/java/com/io/example/DbReaderExampleApplication.java (1)
spring-batch-file-examples/src/main/java/com/io/example/FileReaderExampleApplication.java (1)
  • SpringBootApplication (6-13)
spring-batch-file-examples/src/main/java/com/io/example/exception/GlobalHandlerException.java (2)
spring-batch-db-examples/src/main/java/com/io/example/exception/GlobalHandlerException.java (1)
  • Slf4j (9-19)
spring-batch-file-examples/src/main/java/com/io/example/service/impl/FileBatchServiceImpl.java (1)
  • Slf4j (12-52)
spring-batch-file-examples/src/test/java/com/io/example/controller/TestControllerTest.java (2)
spring-batch-file-examples/src/main/java/com/io/example/exception/BusinessException.java (1)
  • BusinessException (3-13)
spring-batch-db-examples/src/test/java/com/io/example/controller/TestControllerTest.java (1)
  • DisplayName (22-71)
spring-batch-db-examples/src/test/java/com/io/example/service/DBBatchServiceImplTest.java (3)
spring-batch-db-examples/src/main/java/com/io/example/exception/BusinessException.java (1)
  • BusinessException (3-13)
spring-batch-db-examples/src/test/java/com/io/example/controller/TestControllerTest.java (1)
  • DisplayName (22-71)
spring-batch-file-examples/src/test/java/com/io/example/service/FileBatchServiceImplTest.java (1)
  • ExtendWith (23-93)
🪛 Checkov (3.2.334)
spring-batch-file-examples/Dockerfile

[low] 1-47: Ensure that HEALTHCHECK instructions have been added to container images

(CKV_DOCKER_2)

spring-batch-db-examples/Dockerfile

[low] 1-47: Ensure that HEALTHCHECK instructions have been added to container images

(CKV_DOCKER_2)

🪛 Hadolint (2.14.0)
spring-batch-file-examples/Dockerfile

[warning] 16-16: Quote this to prevent word splitting.

(SC2046)


[warning] 40-40: COPY to a relative destination without WORKDIR set.

(DL3045)


[warning] 41-41: COPY to a relative destination without WORKDIR set.

(DL3045)


[warning] 42-42: COPY to a relative destination without WORKDIR set.

(DL3045)


[warning] 43-43: COPY to a relative destination without WORKDIR set.

(DL3045)

spring-batch-db-examples/Dockerfile

[warning] 16-16: Quote this to prevent word splitting.

(SC2046)


[warning] 40-40: COPY to a relative destination without WORKDIR set.

(DL3045)


[warning] 41-41: COPY to a relative destination without WORKDIR set.

(DL3045)


[warning] 42-42: COPY to a relative destination without WORKDIR set.

(DL3045)


[warning] 43-43: COPY to a relative destination without WORKDIR set.

(DL3045)

🪛 LanguageTool
spring-batch-db-examples/src/main/resources/banner.txt

[grammar] ~1-~1: Agrega un espacio.
Context: ,---. ,------. ,------. ,--.,--. ,--. ,----. ,-----. ,---. ,---...

(QB_NEW_ES_OTHER_ERROR_IDS_MISSING_ORTHOGRAPHY_SPACE)


[grammar] ~1-~1: Agrega un espacio.
Context: ... ,-----. ,---. ,--------.,-----.,--. ,--. ,------. ,-----. ' .-'| .-...

(QB_NEW_ES_OTHER_ERROR_IDS_MISSING_ORTHOGRAPHY_SPACE)


[grammar] ~2-~2: Elimina la palabra o signo.
Context: ... ,------. ,-----. ' .-'| .--. '| .--. '| || ,'.| |' .-./ ,-----.| ...

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)


[grammar] ~2-~2: Agrega un espacio.
Context: ...|' .-./ ,-----.| |) /_ / O '--. .--' .--./| '--' |,-----.| .-. \ | ...

(QB_NEW_ES_OTHER_ERROR_IDS_MISSING_ORTHOGRAPHY_SPACE)


[grammar] ~2-~2: Elimina la palabra o signo.
Context: ...-./ ,-----.| |) /_ / O '--. .--' .--./| '--' |,-----.| .-. \ | |) /_...

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)


[grammar] ~2-~2: Elimina la palabra o signo.
Context: ...----.| |) /_ / O '--. .--' .--./| '--' |,-----.| .-. \ | |) /_ . -....

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)


[grammar] ~2-~2: Elimina la palabra o signo.
Context: ... |) /_ / O '--. .--' .--./| '--' |,-----.| .-. \ | |) /_ . -.| '--...

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)


[grammar] ~2-~2: Elimina la palabra o signo.
Context: ...O '--. .--' .--./| '--' |,-----.| .-. \ | |) /_ . -.| '--' || '--'....

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)


[grammar] ~3-~3: Elimina la palabra o signo.
Context: ...-' |,-----.| .-. \ | |) /_ . -.| '--' || '--'.'| || |' ' || | .---.'...

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)


[grammar] ~3-~3: Elimina la palabra o signo.
Context: ...--.| .-. \ | |) /_ . -.| '--' || '--'.'| || |' ' || | .---.'-----'| ...

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)


[grammar] ~3-~3: Elimina la palabra o signo.
Context: ... \ | |) /_ . -.| '--' || '--'.'| || |' ' || | .---.'-----'| .-. \ ....

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)


[grammar] ~3-~3: Elimina la palabra o signo.
Context: ...| |) /_ . -.| '--' || '--'.'| || |' ' || | .---.'-----'| .-. \ .-. ...

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)


[grammar] ~3-~3: Elimina la palabra o signo.
Context: .../_ . -.| '--' || '--'.'| || |' ' || | .---.'-----'| .-. \ .-. | | ...

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)


[grammar] ~3-~3: Elimina la palabra o signo.
Context: .... `-.| '--' || '--'.'| || |' ' || | .---.'-----'| .-. \ .-. | | | |...

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)


[grammar] ~3-~3: Elimina la palabra o signo.
Context: ... '--'.'| || |' ' || | .---.'-----'| .-. \ .-. | | | | | | .--. |...

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)


[grammar] ~3-~3: Elimina la palabra o signo.
Context: ...-. | | | | | | .--. |'-----'| | \ :| .-. \ .-' | | --' | |\ ...

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)


[grammar] ~3-~3: Cambia la palabra o signo.
Context: ... | | | | | | .--. |'-----'| | \ :| .-. \ .-' | | --' | |\ \ |...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_OTHER)


[grammar] ~3-~3: Cambia la palabra o signo.
Context: ... | | | | | .--. |'-----'| | \ :| .-. \ .-' | | --' | |\ \ | |...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_OTHER)


[grammar] ~3-~3: Elimina la palabra o signo.
Context: ...| | | | .--. |'-----'| | \ :| .-. \ .-' | | --' | |\ \ | || |...

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)

🪛 markdownlint-cli2 (0.18.1)
spring-batch-db-examples/README.md

1-1: Trailing spaces
Expected: 0 or 2; Actual: 1

(MD009, no-trailing-spaces)

spring-batch-file-examples/src/main/java/com/io/example/README.md

1-1: Trailing spaces
Expected: 0 or 2; Actual: 1

(MD009, no-trailing-spaces)

🪛 OSV Scanner (2.2.4)
spring-batch-file-examples/pom.xml

[MEDIUM] 1-1: ch.qos.logback:logback-core 1.5.18: QOS.CH logback-core is vulnerable to Arbitrary Code Execution through file processing

(GHSA-25qh-j22f-pwp8)


[MEDIUM] 1-1: org.apache.commons:commons-lang3 3.17.0: Apache Commons Lang is vulnerable to Uncontrolled Recursion when processing long inputs

(GHSA-j288-q9x7-2f5v)


[LOW] 1-1: org.apache.tomcat.embed:tomcat-embed-core 10.1.46: Apache Tomcat Vulnerable to Improper Resource Shutdown or Release

(GHSA-hgrr-935x-pq79)

spring-batch-db-examples/pom.xml

[MEDIUM] 1-1: ch.qos.logback:logback-core 1.5.18: QOS.CH logback-core is vulnerable to Arbitrary Code Execution through file processing

(GHSA-25qh-j22f-pwp8)


[LOW] 1-1: org.apache.tomcat.embed:tomcat-embed-core 10.1.46: Apache Tomcat Vulnerable to Improper Resource Shutdown or Release

(GHSA-hgrr-935x-pq79)

🪛 YAMLlint (1.37.1)
spring-batch-db-examples/.github/workflows/maven.yml

[warning] 3-3: truthy value should be one of [false, true]

(truthy)


[error] 14-14: too many spaces inside brackets

(brackets)


[error] 14-14: too many spaces inside brackets

(brackets)


[error] 15-15: too many spaces inside brackets

(brackets)


[error] 15-15: too many spaces inside brackets

(brackets)

.github/workflows/spring-batch-file-example.yml

[warning] 3-3: truthy value should be one of [false, true]

(truthy)


[error] 23-23: too many spaces inside brackets

(brackets)


[error] 23-23: too many spaces inside brackets

(brackets)


[error] 24-24: too many spaces inside brackets

(brackets)


[error] 24-24: too many spaces inside brackets

(brackets)

.github/workflows/spring-batch-db-example.yml

[warning] 3-3: truthy value should be one of [false, true]

(truthy)


[error] 23-23: too many spaces inside brackets

(brackets)


[error] 23-23: too many spaces inside brackets

(brackets)


[error] 24-24: too many spaces inside brackets

(brackets)


[error] 24-24: too many spaces inside brackets

(brackets)

spring-batch-file-examples/.github/workflows/maven.yml

[warning] 3-3: truthy value should be one of [false, true]

(truthy)


[error] 14-14: too many spaces inside brackets

(brackets)


[error] 14-14: too many spaces inside brackets

(brackets)


[error] 15-15: too many spaces inside brackets

(brackets)


[error] 15-15: too many spaces inside brackets

(brackets)

🔇 Additional comments (57)
spring-batch-db-examples/src/main/resources/banner.txt (1)

1-6: LGTM—static analysis warnings are false positives.

The ASCII art banner is properly formatted and will display correctly as the Spring Boot startup banner. The LanguageTool warnings are false positives; the tool is attempting to parse ASCII art sequences as Spanish text, which is a known limitation when analyzing non-linguistic visual content. These warnings can be safely ignored.

spring-batch-file-examples/src/main/resources/banner.txt (1)

1-6: LGTM—static analysis warnings are false positives.

The ASCII art banner is properly formatted and mirrors the branding approach used in the spring-batch-db-examples module. The LanguageTool warnings are false positives; they result from the tool attempting to parse ASCII art as Spanish text. These warnings can be safely ignored for visual/decorative resources.

spring-batch-file-examples/.gitattributes (1)

1-2: LGTM!

The line-ending normalization is correctly configured: mvnw uses Unix line endings, and Windows batch files use CRLF. This ensures cross-platform Maven wrapper compatibility.

spring-batch-db-examples/.gitattributes (1)

1-2: LGTM!

Consistent line-ending configuration with the spring-batch-file-examples module.

spring-batch-db-examples/src/main/resources/application.yml (1)

1-25: LGTM!

The configuration is appropriate for a Spring Batch example: H2 in-memory database, create-drop DDL for demos, job.enabled: false to prevent auto-execution, and a reasonable batch size of 1000.

pom.xml (1)

20-21: LGTM!

Both new modules are properly added to the parent POM's module list.

spring-batch-db-examples/.mvn/wrapper/maven-wrapper.properties (1)

1-3: LGTM!

Maven 3.9.11 is the latest version, and the only-script distribution type is appropriate for CI/CD environments. The configuration is secure and current.

spring-batch-file-examples/.mvn/wrapper/maven-wrapper.properties (1)

1-3: LGTM!

Consistent Maven wrapper configuration with the spring-batch-db-examples module.

spring-batch-file-examples/.gitignore (1)

1-32: LGTM!

Standard Maven and IDE-specific ignores are correctly configured. Negation patterns preserve intentional build artifacts in src/main and src/test directories.

spring-batch-db-examples/.gitignore (1)

1-32: LGTM!

The .gitignore file follows standard patterns for Java/Maven/Spring Boot projects, with appropriate exclusions for build outputs, IDE metadata, and Maven wrapper artifacts, plus necessary negations for source directories.

spring-batch-file-examples/src/main/java/com/io/example/README.md (1)

7-37: LGTM!

The content clearly describes the purpose and scope of the file-based batch processing examples, with appropriate extensibility considerations for multiple file formats.

spring-batch-file-examples/.dockerignore (1)

1-62: LGTM!

Comprehensive .dockerignore with appropriate patterns to exclude IDE files, build artifacts, VCS directories, and sensitive files from the Docker build context.

spring-batch-db-examples/.dockerignore (1)

1-62: LGTM!

Comprehensive .dockerignore with appropriate patterns for excluding non-essential files from the Docker build context.

spring-batch-file-examples/src/test/java/com/io/example/util/DataUtils.java (1)

6-15: LGTM!

Clean and focused test utility that creates JobParameters with timestamp and file path, appropriate for file-based batch job testing.

spring-batch-file-examples/src/test/java/com/io/example/FileReaderExampleApplicationTest.java (1)

1-25: Boot application tests look correct

Both contextLoads() and main_shouldCallSpringApplicationRun() are idiomatic for verifying Spring Boot startup and main delegation; no issues spotted.

spring-batch-db-examples/src/main/java/com/io/example/service/DBBatchService.java (1)

1-8: Service contract is clear and minimal

DBBatchService cleanly defines the two primary operations (run job and fetch status) with appropriate types for a Spring Batch example.

spring-batch-file-examples/src/main/java/com/io/example/FileReaderExampleApplication.java (1)

1-13: Spring Boot entry point is idiomatic

FileReaderExampleApplication is a standard, minimal Spring Boot main class and matches the testing strategy; no changes needed.

spring-batch-db-examples/src/main/java/com/io/example/listener/LoggingStepListener.java (1)

1-27: Step listener implementation is straightforward and safe

LoggingStepListener cleanly logs key step metrics before and after execution and correctly returns the existing ExitStatus without altering flow; looks good for debugging batch examples.

spring-batch-db-examples/src/test/java/com/io/example/util/DataUtils.java (1)

1-35: Test utility methods are appropriate for the DB batch examples

DataUtils neatly centralises common test setup (JobParameters, random entities, and reader stubbing) and the configJdbcPagingItemReaderMock sequence (items then null) aligns with Spring Batch reader expectations; no issues found.

spring-batch-db-examples/mvnw.cmd (1)

1-189: Standard Maven Wrapper script added

This matches the stock Maven Wrapper mvnw.cmd (with ASF license and usual download/bootstrap logic) and is appropriate to include for Windows builds; no changes needed.

README.md (1)

19-20: LGTM!

The new Spring Batch entries follow the existing documentation pattern and provide clear, concise descriptions consistent with the repository's style.

spring-batch-db-examples/src/test/java/com/io/example/service/TestServiceImplTest.java (1)

12-16: Test pattern aligns with project style.

The minimal test approach without assertions is appropriate for this demonstration project, focusing on method execution and logging side effects.

Based on learnings

spring-batch-db-examples/README.md (1)

1-30: Clear and concise documentation.

The README effectively describes the Spring Batch DB example with appropriate level of detail for a demonstration project.

Based on learnings

spring-batch-file-examples/src/test/java/com/io/example/service/TestServiceImplTest.java (1)

8-17: LGTM!

The test follows the minimal pattern appropriate for this demonstration project and correctly uses StudentDto for the file-examples module.

Based on learnings

spring-batch-file-examples/src/main/resources/application.yml (1)

25-25: The review comment is incorrect. The implementation is valid.

Spring Batch configures chunk sizes programmatically in step definitions, and spring.batch.chunk-size is not a standard Spring Boot auto-configuration property. However, this codebase uses a legitimate pattern: defining a custom application property (spring.batch.chunk-size) in application.yml, injecting it via @Value into configuration beans, and passing it to the programmatic .chunk(chunkSize, transactionManager) method calls.

The script results confirm this property is actively wired and used correctly in:

  • spring-batch-file-examples/src/main/java/com/io/example/config/ExcelBatchConfig.java:82-84
  • spring-batch-db-examples/src/main/java/com/io/example/config/BatchConfig.java:89,92

This approach is valid and provides the benefit of externalizing chunk size configuration without hardcoding it.

spring-batch-db-examples/pom.xml (1)

1-172: Verify whether Spring Boot 3.5.6 includes vulnerable transitive dependencies.

The identified vulnerabilities are real:

  • GHSA-25qh-j22f-pwp8: logback-core versions up to 1.5.18 contain an ACE vulnerability, fixed in 1.5.19
  • GHSA-hgrr-935x-pq79: Apache Tomcat 10.1.0-M1 through 10.1.46 contain an Improper Resource Shutdown vulnerability, fixed in 10.1.47

However, I cannot determine from available sources the exact versions of logback-core and tomcat-embed-core that Spring Boot 3.5.6 manages transitively. You should verify by running mvn dependency:tree or checking the generated pom-effective.xml to confirm whether these vulnerabilities affect your build. If affected, upgrade Spring Boot to a more recent patch version or override the managed versions in <dependencyManagement> to patch versions.

spring-batch-db-examples/src/main/java/com/io/example/service/TestService.java (1)

1-7: LGTM!

Clean, minimal interface appropriate for demonstration purposes. The single-method contract is clear and aligns well with the batch processing example.

spring-batch-db-examples/src/test/resources/application-test.yml (1)

1-26: LGTM!

Test configuration is well-structured with appropriate H2 in-memory setup, schema initialization, and batch settings suitable for integration testing.

spring-batch-file-examples/src/main/java/com/io/example/service/TestService.java (1)

1-7: LGTM!

Simple, focused interface appropriate for the file-based batch processing example. The use of StudentDto correctly aligns with this module's domain.

spring-batch-db-examples/src/main/java/com/io/example/repository/TestEntityRepository.java (1)

7-9: LGTM!

Standard Spring Data JPA repository following framework conventions. The interface provides the necessary CRUD operations for TestEntity.

spring-batch-file-examples/.github/workflows/maven.yml (1)

1-30: LGTM! Workflow is functional and well-structured.

The CI workflow correctly builds and verifies the project with Java 21. Static analysis hints about YAML formatting (bracket spacing on Lines 14-15) are stylistic preferences that don't affect functionality.

spring-batch-file-examples/compose.yaml (1)

1-21: LGTM!

Docker Compose configuration properly mirrors the application settings with H2 in-memory database and Spring Batch configuration. The hard-coded container name app (Line 4) aligns with CI pipeline requirements.

Based on learnings

spring-batch-db-examples/compose.yaml (1)

1-21: LGTM! Configuration aligns with Spring Batch best practices.

The Docker Compose configuration correctly sets up an H2 in-memory database with appropriate Spring Batch settings. The SPRING_BATCH_JOB_ENABLED=false environment variable properly prevents auto-execution of batch jobs on startup, which is the recommended approach for production-like environments where jobs should be triggered explicitly.

spring-batch-file-examples/src/main/java/com/io/example/service/FileBatchService.java (1)

5-8: LGTM!

The service interface provides a clean contract for batch job execution and status tracking. The method signatures are appropriate for asynchronous job launching (returning execution ID) and status querying.

spring-batch-db-examples/src/main/java/com/io/example/job/BatchJob.java (1)

11-20: LGTM!

The batch job configuration correctly uses the Spring Batch JobBuilder API to define a job that starts with the provided async step. The implementation follows Spring Batch best practices.

spring-batch-db-examples/src/main/java/com/io/example/service/impl/TestServiceImpl.java (1)

8-16: LGTM!

The service implementation is clean and appropriate for example code. The logging provides visibility into processed items during batch execution.

spring-batch-file-examples/src/main/java/com/io/example/exception/GlobalHandlerException.java (1)

9-18: LGTM!

The global exception handler follows Spring's best practices by centralizing exception handling with @ControllerAdvice and providing appropriate HTTP status codes and logging for business exceptions.

spring-batch-db-examples/src/main/java/com/io/example/DbReaderExampleApplication.java (1)

1-13: Entry-point class is minimal and consistent.

The DbReaderExampleApplication main class is a straightforward entrypoint and aligns with the pattern used in the file-based example module; no changes needed.

spring-batch-db-examples/src/main/resources/application-prd.yml (1)

1-25: Production profile configuration looks coherent and env-driven.

The application-prd.yml cleanly delegates server, datasource, JPA, H2 console, and batch settings to environment variables, which fits well with the Docker/compose setup and keeps production behavior externally configurable.

spring-batch-db-examples/src/main/java/com/io/example/exception/GlobalHandlerException.java (1)

1-19: Global business exception handler is consistent and appropriate for examples.

The GlobalHandlerException cleanly centralizes BusinessException handling, logs the error, and returns a 400 with the message, matching the pattern used in the file-based module and keeping the example simple.

spring-batch-db-examples/src/main/java/com/io/example/model/dto/TestDto.java (1)

8-21: LGTM!

The DTO structure is clean and appropriate for Spring Batch examples. The Lombok annotations correctly generate all necessary boilerplate, and the fields mirror the TestEntity structure.

spring-batch-file-examples/src/main/java/com/io/example/service/impl/TestServiceImpl.java (1)

8-17: LGTM!

The service implementation is clean and appropriate for demonstration purposes. The logging provides visibility into batch processing without unnecessary complexity.

Note: This implementation mirrors the DB module's TestServiceImpl, which maintains consistency across examples.

spring-batch-file-examples/src/main/java/com/io/example/job/FileJob.java (1)

11-22: LGTM!

The job configuration follows Spring Batch best practices. The job name "excelJob" clearly indicates its purpose, and the structure is consistent with the DB module's BatchJob pattern.

spring-batch-file-examples/src/test/java/com/io/example/controller/TestControllerTest.java (2)

24-47: LGTM!

The test correctly validates the happy path for job processing, including proper mocking and response verification.


49-60: LGTM!

Excellent use of @ParameterizedTest with @EnumSource to verify all possible BatchStatus values. This ensures comprehensive coverage without repetitive test code.

spring-batch-db-examples/src/main/java/com/io/example/controller/TestController.java (1)

23-27: LGTM!

The endpoint correctly delegates to the service layer and returns the job ID with proper HTTP status.

spring-batch-db-examples/src/test/java/com/io/example/controller/TestControllerTest.java (2)

34-44: LGTM!

The test properly validates the job processing endpoint with correct mocking and assertions.


46-57: LGTM!

Excellent use of parameterized testing to verify all BatchStatus enum values comprehensively.

spring-batch-db-examples/src/main/java/com/io/example/service/impl/DBBatchServiceImpl.java (1)

12-51: LGTM!

The service implementation follows Spring Batch best practices:

  • Async job execution with proper logging
  • Exception wrapping with BusinessException for consistent error handling
  • Null-safe status retrieval with clear error messages
  • Timestamp-based parameters to ensure unique job instances

The implementation is clean, well-structured, and appropriate for a batch processing example.

spring-batch-db-examples/src/main/java/com/io/example/mapper/TestEntityMapper.java (1)

7-19: Mapping implementation is clear and consistent

TestEntityMapper cleanly maps all relevant fields from TestEntity to TestDto via the builder and fits well as a Spring Batch ItemProcessor in this example context.

spring-batch-db-examples/src/test/java/com/io/example/job/BatchJobIntegrationTest.java (1)

25-84: Integration tests provide solid coverage of happy path and edge cases

The three scenarios (successful run with items, reader failure, and no data) nicely exercise the batch job wiring, reader behavior, and writer interaction (TestService.print), giving good confidence in the end‑to‑end configuration.

spring-batch-file-examples/src/main/java/com/io/example/service/impl/FileBatchServiceImpl.java (1)

12-50: Service logic is consistent and straightforward for the file batch example

runJob() and getJobStatus() mirror the DB batch service pattern, with appropriate logging and BusinessException wrapping, and getParameters() cleanly adds both a uniqueness parameter and the fixed filePath used by the job. This fits well for a simple example service.

spring-batch-file-examples/src/main/java/com/io/example/controller/TestController.java (1)

12-29: Controller endpoints are clear and consistent with the service API

The mappings and delegation to FileBatchService are straightforward, and the returned types (Long job id and String status) are appropriate for this example controller. No issues from a correctness or design perspective.

Please run the existing controller tests for the file module to confirm everything still passes after wiring this controller.

spring-batch-db-examples/mvnw (1)

1-294: Standard Maven wrapper script – keep as generated

This looks like the stock Maven Wrapper (3.3.4) script. It’s good to keep it unchanged and in sync with the Maven Wrapper plugin configuration, rather than hand-editing it.

Before merging, ensure the wrapper configuration (.mvn/wrapper/maven-wrapper.properties) matches the Maven version you intend to standardize on for this module.

spring-batch-file-examples/mvnw.cmd (1)

1-189: Windows Maven wrapper appears standard and should remain managed by Maven Wrapper

This mvnw.cmd matches the usual Maven Wrapper implementation (batch front + PowerShell logic). Treat it as a generated file and avoid manual edits so it stays aligned with the Maven Wrapper plugin configuration.

Confirm that this wrapper script and the Unix mvnw were generated from the same Maven Wrapper plugin version to avoid cross-platform inconsistencies.

spring-batch-file-examples/mvnw (1)

1-295: Standard Maven wrapper script – OK to keep verbatim

This is the stock Maven Wrapper (3.3.4) script and looks unmodified from upstream; committing it as-is is the right call so this module is self-contained and buildable via ./mvnw without a preinstalled Maven.

spring-batch-file-examples/src/test/java/com/io/example/job/BatchJobIntegrationTest.java (1)

22-74: Excel batch integration tests are well-structured; resources verified and correctly placed

The three scenarios (happy path, error path, and empty file) give good coverage and match the ExcelBatchConfig contract, using real job execution via JobLauncherTestUtils and a Mockito-overridden TestService. Verification confirms all required Excel test resources are present at the expected classpath paths under src/test/resources/files/:

  • students.xlsx
  • students-error.xlsx
  • students-empty.xlsx

The test setup is minimal and sound.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review continued from previous batch...

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (6)
spring-batch-file-examples/src/main/resources/application-prd.yml (2)

26-26: ** Inconsistent batch property name with chunk-size.**

Spring Batch's chunk size defines the number of items processed in a single transaction; when the chunk size is reached, Spring Batch commits the transaction and a new chunk begins. The property batch-size is not a Spring Batch standard property and typically refers to JDBC/Hibernate statement batching, not Spring Batch commit behavior. This file should use chunk-size consistently, as shown in the corresponding application.yml (line 25 in spring-batch-db-examples/src/main/resources/application.yml uses chunk-size: 1000).

Consider renaming to align with Spring Batch conventions:

     chunk-size: ${SPRING_BATCH_CHUNK_SIZE}
-    batch-size: ${SPRING_BATCH_BATCH_SIZE}
+    batch-size: ${SPRING_BATCH_BATCH_SIZE}  # Consider renaming to chunk-size for consistency

18-18: ** Security concern: H2 console enabled in production via environment variable.**

Enabling the H2 console in production poses a security risk by exposing database access through a web interface. A previous review flagged this issue. For production deployments, this should be hardcoded to false rather than driven by an environment variable.

Apply this fix:

   h2:
     console:
-      enabled: ${SPRING_H2_CONSOLE_ENABLED}
+      enabled: false
       path: ${SPRING_H2_CONSOLE_PATH}
spring-batch-db-examples/src/main/resources/application-prd.yml (2)

26-26: ** Inconsistent batch property name with chunk-size.**

Spring Batch's chunk size defines the number of items processed in a single transaction; when the chunk size is reached, Spring Batch commits the transaction and a new chunk begins. The property batch-size is not a Spring Batch standard property and typically refers to JDBC/Hibernate statement batching, not Spring Batch commit behavior. For consistency with Spring Batch conventions, consider using chunk-size instead.


18-18: ** Security concern: H2 console enabled in production via environment variable.**

Enabling the H2 console in production poses a security risk by exposing database access through a web interface. For production deployments, this should be hardcoded to false rather than driven by an environment variable.

spring-batch-file-examples/src/test/resources/application-test.yml (1)

12-19: ** Fix YAML indentation for JPA and H2 configuration.**

This configuration issue was flagged in a previous review and remains unresolved. The jpa and h2 blocks are incorrectly nested under datasource instead of being siblings at the spring level. This prevents Spring Boot from recognizing the JPA and H2 configurations.

Apply the corrected indentation:

     datasource:
       url: jdbc:h2:mem:db
       driver-class-name: org.h2.Driver
       username: sa
       password:
 
-    jpa:
-      hibernate:
-        ddl-auto: create-drop
+  jpa:
+    hibernate:
+      ddl-auto: create-drop
 
-    h2:
-      console:
-        enabled: true
-        path: /h2-console
+  h2:
+    console:
+      enabled: true
+      path: /h2-console
 
   batch:
spring-batch-file-examples/src/main/resources/application.yml (1)

12-19: ** Fix YAML indentation for JPA and H2 configuration.**

This configuration issue was flagged in a previous review and remains unresolved. The jpa and h2 blocks are incorrectly nested under datasource instead of being siblings at the spring level. This prevents Spring Boot from recognizing the JPA and H2 configurations.

Apply the corrected indentation:

     datasource:
       url: jdbc:h2:mem:db
       driver-class-name: org.h2.Driver
       username: sa
       password:
 
-    jpa:
-      hibernate:
-        ddl-auto: create-drop
+  jpa:
+    hibernate:
+      ddl-auto: create-drop
 
-    h2:
-      console:
-        enabled: true
-        path: /h2-console
+  h2:
+    console:
+      enabled: true
+      path: /h2-console
 
   batch:
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cddcce6 and 8fb5394.

📒 Files selected for processing (7)
  • spring-batch-db-examples/compose.yaml (1 hunks)
  • spring-batch-db-examples/src/main/resources/application-prd.yml (1 hunks)
  • spring-batch-db-examples/src/main/resources/application.yml (1 hunks)
  • spring-batch-file-examples/compose.yaml (1 hunks)
  • spring-batch-file-examples/src/main/resources/application-prd.yml (1 hunks)
  • spring-batch-file-examples/src/main/resources/application.yml (1 hunks)
  • spring-batch-file-examples/src/test/resources/application-test.yml (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: igorcampos-dev
Repo: igorcampos-dev/spring-integrations-examples PR: 40
File: spring-kafka-example/src/main/java/com/io/example/consumer/KafkaConsumerServiceImpl.java:18-22
Timestamp: 2025-07-27T19:57:31.204Z
Learning: In the spring-integrations-examples project, user igorcampos-dev prefers to keep simple example implementations minimal without additional error handling complexity, as the examples are for demonstration purposes rather than production use.
Learnt from: igorcampos-dev
Repo: igorcampos-dev/spring-integrations-examples PR: 21
File: spring-kafka-example/README.md:12-17
Timestamp: 2025-07-22T01:35:41.406Z
Learning: User igorcampos-dev prefers minimal, high-level documentation in README files without detailed version specifications, choosing to keep tech stack information simple rather than adding precise version numbers.
Learnt from: igorcampos-dev
Repo: igorcampos-dev/spring-integrations-examples PR: 21
File: spring-kafka-example/compose.yaml:30-32
Timestamp: 2025-07-22T01:30:57.054Z
Learning: User igorcampos-dev prefers to maintain environment parity between local development and production, avoiding development-specific configurations like ALLOW_PLAINTEXT_LISTENER even when they might provide clearer intent or safety nets.
Learnt from: igorcampos-dev
Repo: igorcampos-dev/spring-integrations-examples PR: 26
File: spring-kafka-example/compose.yaml:3-4
Timestamp: 2025-07-24T01:40:49.337Z
Learning: User igorcampos-dev requires hard-coded container names in Docker Compose files (like `container_name: app`) for CI pipeline validation purposes, which is a valid operational requirement that overrides the general best practice of avoiding hard-coded container names.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Health Check on Services
🔇 Additional comments (3)
spring-batch-file-examples/compose.yaml (1)

1-22: Configuration looks good.

The Docker Compose configuration properly exposes port 8082, sets appropriate environment variables matching the production configuration profile, and maintains the container name for CI validation purposes (per operational requirements). The environment variables are well-structured and align with the application-prd.yml template.

spring-batch-db-examples/compose.yaml (1)

1-22: Configuration looks good.

The Docker Compose configuration is consistent with the spring-batch-file-examples module, properly exposes port 8082, and sets appropriate environment variables aligned with the application-prd.yml configuration profile. The container name is hardcoded for CI validation purposes (per operational requirements).

spring-batch-db-examples/src/main/resources/application-prd.yml (1)

25-25: Configuration looks good.

The chunk-size property is correctly named, unlike the corresponding file in spring-batch-file-examples (which has a syntax error on this line).

@igorcampos-dev igorcampos-dev merged commit e5f468d into master Nov 18, 2025
6 of 7 checks passed
@igorcampos-dev igorcampos-dev deleted the feature/spring-batch-examples branch November 18, 2025 01:00
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (4)
spring-batch-file-examples/src/main/resources/application-prd.yml (2)

16-19: H2 console should not be enabled in production (previously flagged).

This configuration allows the H2 console to be enabled via the SPRING_H2_CONSOLE_ENABLED environment variable in production, which poses a security risk by exposing database access through a web interface. Set this to false for production.

   h2:
     console:
-      enabled: ${SPRING_H2_CONSOLE_ENABLED}
+      enabled: false
       path: ${SPRING_H2_CONSOLE_PATH}

26-26: Remove non-standard batch-size property (previously flagged).

The batch-size property is not a Spring Batch standard; it typically refers to JDBC/Hibernate statement batching. This file should use only chunk-size (line 25) to control items processed per transaction, consistent with Spring Batch semantics and your application.yml configuration.

   batch:
     initialize-schema: ${SPRING_BATCH_INITIALIZE_SCHEMA}
     job:
       enabled: ${SPRING_BATCH_JOB_ENABLED}
     chunk-size: ${SPRING_BATCH_CHUNK_SIZE}
-    batch-size: ${SPRING_BATCH_BATCH_SIZE}
spring-batch-db-examples/src/test/java/com/io/example/controller/TestControllerTest.java (2)

32-32: Field naming convention violation (already flagged).

The mock field name DBBatchService violates Java naming conventions. Field names should be in camelCase (dbBatchService), with updates required at lines 38, 51, and 63 where the field is referenced.


59-69: Display name inconsistency and whitespace issue (already flagged).

Two issues previously identified:

  1. Line 60: Display name says "should return 404" but Line 68 asserts isBadRequest() which is 400 status.
  2. Line 68: Extra whitespace before the closing parenthesis.

These should be corrected to maintain consistency and code quality.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8fb5394 and a3b55e4.

📒 Files selected for processing (3)
  • spring-batch-db-examples/src/test/java/com/io/example/controller/TestControllerTest.java (1 hunks)
  • spring-batch-file-examples/src/main/resources/application-prd.yml (1 hunks)
  • spring-batch-file-examples/src/test/java/com/io/example/controller/TestControllerTest.java (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: igorcampos-dev
Repo: igorcampos-dev/spring-integrations-examples PR: 40
File: spring-kafka-example/src/main/java/com/io/example/consumer/KafkaConsumerServiceImpl.java:18-22
Timestamp: 2025-07-27T19:57:31.204Z
Learning: In the spring-integrations-examples project, user igorcampos-dev prefers to keep simple example implementations minimal without additional error handling complexity, as the examples are for demonstration purposes rather than production use.
Learnt from: igorcampos-dev
Repo: igorcampos-dev/spring-integrations-examples PR: 21
File: spring-kafka-example/README.md:12-17
Timestamp: 2025-07-22T01:35:41.406Z
Learning: User igorcampos-dev prefers minimal, high-level documentation in README files without detailed version specifications, choosing to keep tech stack information simple rather than adding precise version numbers.
Learnt from: igorcampos-dev
Repo: igorcampos-dev/spring-integrations-examples PR: 21
File: spring-kafka-example/compose.yaml:30-32
Timestamp: 2025-07-22T01:30:57.054Z
Learning: User igorcampos-dev prefers to maintain environment parity between local development and production, avoiding development-specific configurations like ALLOW_PLAINTEXT_LISTENER even when they might provide clearer intent or safety nets.
Learnt from: igorcampos-dev
Repo: igorcampos-dev/spring-integrations-examples PR: 26
File: spring-kafka-example/compose.yaml:3-4
Timestamp: 2025-07-24T01:40:49.337Z
Learning: User igorcampos-dev requires hard-coded container names in Docker Compose files (like `container_name: app`) for CI pipeline validation purposes, which is a valid operational requirement that overrides the general best practice of avoiding hard-coded container names.
🧬 Code graph analysis (2)
spring-batch-db-examples/src/test/java/com/io/example/controller/TestControllerTest.java (2)
spring-batch-db-examples/src/main/java/com/io/example/exception/BusinessException.java (1)
  • BusinessException (3-13)
spring-batch-file-examples/src/test/java/com/io/example/controller/TestControllerTest.java (1)
  • WebMvcTest (24-74)
spring-batch-file-examples/src/test/java/com/io/example/controller/TestControllerTest.java (2)
spring-batch-file-examples/src/main/java/com/io/example/exception/BusinessException.java (1)
  • BusinessException (3-13)
spring-batch-db-examples/src/test/java/com/io/example/controller/TestControllerTest.java (1)
  • DisplayName (22-71)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Health Check on Services
🔇 Additional comments (3)
spring-batch-file-examples/src/test/java/com/io/example/controller/TestControllerTest.java (3)

1-27: LGTM! Clean test setup with proper annotations.

The test class is well-configured with @WebMvcTest for controller testing, imports the GlobalHandlerException to ensure exception handling works correctly, and uses the modern @MockitoBean annotation (Spring Boot 3.4+).


37-60: LGTM! Excellent test coverage.

The first test validates successful job processing, and the parameterized test elegantly covers all BatchStatus enum values, providing comprehensive coverage with minimal code duplication.


62-72: LGTM! The display name/assertion inconsistency has been resolved.

The test now correctly and consistently indicates 400 Bad Request in both the display name (line 63), method name (line 64), and assertion (line 71). This properly tests that BusinessException is mapped to 400 by the GlobalHandlerException.

Comment on lines +22 to +23
@DisplayName("TestController - Unit tests with MockMvc")
@WebMvcTest(TestController.class)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Missing @import annotation for exception handler.

The test class is missing @Import(GlobalHandlerException.class), which is required to load the exception handler into the Spring test context. Without it, the shouldReturn400WhenJobIdIsInvalid test will fail because BusinessException won't be properly handled and mapped to a 400 Bad Request status.

Apply this diff:

 @DisplayName("TestController - Unit tests with MockMvc")
 @WebMvcTest(TestController.class)
+@Import(GlobalHandlerException.class)
 class TestControllerTest {

Note: This matches the pattern used in the parallel test file at spring-batch-file-examples/src/test/java/com/io/example/controller/TestControllerTest.java (line 25).

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@DisplayName("TestController - Unit tests with MockMvc")
@WebMvcTest(TestController.class)
@DisplayName("TestController - Unit tests with MockMvc")
@WebMvcTest(TestController.class)
@Import(GlobalHandlerException.class)
class TestControllerTest {
🤖 Prompt for AI Agents
In
spring-batch-db-examples/src/test/java/com/io/example/controller/TestControllerTest.java
around lines 22 to 23, the test class is missing the
@Import(GlobalHandlerException.class) annotation so the GlobalHandlerException
isn't loaded into the Spring test context; add
@Import(GlobalHandlerException.class) to the test class annotations (alongside
@WebMvcTest and @DisplayName) so BusinessException is handled and the
shouldReturn400WhenJobIdIsInvalid test maps exceptions to HTTP 400.

@Import(GlobalHandlerException.class)
class TestControllerTest {

private static final Long jobId = Instancio.create(Long.class);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Consider using a predictable jobId value.

While the random jobId is functionally correct, using a predictable value (e.g., 1L) would make test failures easier to debug and maintain.

Apply this diff if you prefer predictable test data:

-    private static final Long jobId = Instancio.create(Long.class);
+    private static final Long jobId = 1L;

Based on learnings

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private static final Long jobId = Instancio.create(Long.class);
private static final Long jobId = 1L;
🤖 Prompt for AI Agents
In
spring-batch-file-examples/src/test/java/com/io/example/controller/TestControllerTest.java
around line 29, the test defines jobId using a random generator
(Instancio.create(Long.class)); replace this with a fixed, predictable value
such as 1L (e.g., private static final Long jobId = 1L) so test data is
deterministic and failures are easier to reproduce and debug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants