-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/spring batch examples #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… update error messages to English
…tion tests for async job
… and improve test coverage
…support and refactor batch service
…use property version
… configuration, and add new test files
…dules, add application configuration, integration tests, and utility methods for batch processing
…rage in integration and unit tests
….0.0 for db and file examples
…tabase and file integrations
…rkflows for batch examples
WalkthroughAdds 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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this 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
⛔ Files ignored due to path filters (4)
spring-batch-file-examples/src/main/resources/files/students.xlsxis excluded by!**/*.xlsxspring-batch-file-examples/src/test/resources/files/students-empty.xlsxis excluded by!**/*.xlsxspring-batch-file-examples/src/test/resources/files/students-error.xlsxis excluded by!**/*.xlsxspring-batch-file-examples/src/test/resources/files/students.xlsxis 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.txtREADME.mdspring-batch-file-examples/.gitignorespring-batch-file-examples/src/main/resources/banner.txtspring-batch-file-examples/src/main/java/com/io/example/README.mdspring-batch-file-examples/pom.xmlspring-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/.dockerignorespring-batch-file-examples/.gitignorespring-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
[MEDIUM] 1-1: org.apache.commons:commons-lang3 3.17.0: Apache Commons Lang is vulnerable to Uncontrolled Recursion when processing long inputs
[LOW] 1-1: org.apache.tomcat.embed:tomcat-embed-core 10.1.46: Apache Tomcat Vulnerable to Improper Resource Shutdown or Release
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
[LOW] 1-1: org.apache.tomcat.embed:tomcat-embed-core 10.1.46: Apache Tomcat Vulnerable to Improper Resource Shutdown or Release
🪛 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-examplesmodule. 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:
mvnwuses 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-dropDDL for demos,job.enabled: falseto 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/mainandsrc/testdirectories.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 correctBoth
contextLoads()andmain_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
DBBatchServicecleanly 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
FileReaderExampleApplicationis 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
LoggingStepListenercleanly logs key step metrics before and after execution and correctly returns the existingExitStatuswithout 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
DataUtilsneatly centralises common test setup (JobParameters, random entities, and reader stubbing) and theconfigJdbcPagingItemReaderMocksequence (items thennull) aligns with Spring Batch reader expectations; no issues found.spring-batch-db-examples/mvnw.cmd (1)
1-189: Standard Maven Wrapper script addedThis 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
StudentDtofor 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-sizeis not a standard Spring Boot auto-configuration property. However, this codebase uses a legitimate pattern: defining a custom application property (spring.batch.chunk-size) inapplication.yml, injecting it via@Valueinto 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-84spring-batch-db-examples/src/main/java/com/io/example/config/BatchConfig.java:89,92This 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:treeor checking the generatedpom-effective.xmlto 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
StudentDtocorrectly 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=falseenvironment 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
JobBuilderAPI 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
@ControllerAdviceand 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
DbReaderExampleApplicationmain 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.ymlcleanly 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
GlobalHandlerExceptioncleanly centralizesBusinessExceptionhandling, 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
@ParameterizedTestwith@EnumSourceto verify all possibleBatchStatusvalues. 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
BatchStatusenum 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
BusinessExceptionfor 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
TestEntityMappercleanly maps all relevant fields fromTestEntitytoTestDtovia the builder and fits well as a Spring BatchItemProcessorin 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 casesThe 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()andgetJobStatus()mirror the DB batch service pattern, with appropriate logging andBusinessExceptionwrapping, andgetParameters()cleanly adds both a uniqueness parameter and the fixedfilePathused 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 APIThe mappings and delegation to
FileBatchServiceare straightforward, and the returned types (Longjob id andStringstatus) 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 generatedThis 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 WrapperThis
mvnw.cmdmatches 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
mvnwwere 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 verbatimThis 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
./mvnwwithout 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 placedThe three scenarios (happy path, error path, and empty file) give good coverage and match the ExcelBatchConfig contract, using real job execution via
JobLauncherTestUtilsand a Mockito-overriddenTestService. Verification confirms all required Excel test resources are present at the expected classpath paths undersrc/test/resources/files/:
students.xlsxstudents-error.xlsxstudents-empty.xlsxThe test setup is minimal and sound.
spring-batch-file-examples/src/test/java/com/io/example/controller/TestControllerTest.java
Show resolved
Hide resolved
spring-batch-file-examples/src/test/java/com/io/example/mapper/StudentMapperTest.java
Show resolved
Hide resolved
spring-batch-file-examples/src/test/java/com/io/example/service/FileBatchServiceImplTest.java
Show resolved
Hide resolved
There was a problem hiding this 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...
spring-batch-db-examples/src/main/java/com/io/example/config/BatchConfig.java
Show resolved
Hide resolved
…odule structure for database and file examples
There was a problem hiding this 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-sizeis not a Spring Batch standard property and typically refers to JDBC/Hibernate statement batching, not Spring Batch commit behavior. This file should usechunk-sizeconsistently, as shown in the corresponding application.yml (line 25 in spring-batch-db-examples/src/main/resources/application.yml useschunk-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
falserather 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-sizeis 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 usingchunk-sizeinstead.
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
falserather 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
jpaandh2blocks are incorrectly nested underdatasourceinstead of being siblings at thespringlevel. 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
jpaandh2blocks are incorrectly nested underdatasourceinstead of being siblings at thespringlevel. 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
📒 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-sizeproperty is correctly named, unlike the corresponding file in spring-batch-file-examples (which has a syntax error on this line).
spring-batch-file-examples/src/main/resources/application-prd.yml
Outdated
Show resolved
Hide resolved
…te test expectations for invalid job ID
There was a problem hiding this 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_ENABLEDenvironment variable in production, which poses a security risk by exposing database access through a web interface. Set this tofalsefor production.h2: console: - enabled: ${SPRING_H2_CONSOLE_ENABLED} + enabled: false path: ${SPRING_H2_CONSOLE_PATH}
26-26: Remove non-standardbatch-sizeproperty (previously flagged).The
batch-sizeproperty is not a Spring Batch standard; it typically refers to JDBC/Hibernate statement batching. This file should use onlychunk-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
DBBatchServiceviolates 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:
- Line 60: Display name says "should return 404" but Line 68 asserts
isBadRequest()which is 400 status.- 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
📒 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
@WebMvcTestfor controller testing, imports theGlobalHandlerExceptionto ensure exception handling works correctly, and uses the modern@MockitoBeanannotation (Spring Boot 3.4+).
37-60: LGTM! Excellent test coverage.The first test validates successful job processing, and the parameterized test elegantly covers all
BatchStatusenum 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
BusinessExceptionis mapped to 400 by theGlobalHandlerException.
| @DisplayName("TestController - Unit tests with MockMvc") | ||
| @WebMvcTest(TestController.class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| @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); |
There was a problem hiding this comment.
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.
| 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.
Summary by CodeRabbit