Skip to content

Conversation

@nanotaboada
Copy link
Owner

@nanotaboada nanotaboada commented Dec 3, 2025


This change is Reviewable

Summary by CodeRabbit

  • New Features

    • Added caching support to improve application performance
    • Integrated API documentation for better developer experience
    • Added production monitoring and health check capabilities
  • Infrastructure & Upgrades

    • Upgraded Java runtime from version 21 to version 25
    • Upgraded framework from version 3 to version 4
    • Migrated CI/CD pipeline from Azure Pipelines to GitHub Actions
    • Updated Docker images to support new Java version

✏️ Tip: You can customize this high-level summary in your review settings.

- Upgrade Spring Boot from 3.4.4 to 4.0.0
- Upgrade JDK from 21 to 25 (LTS)
- Migrate spring-boot-starter-web to spring-boot-starter-webmvc
- Add modular test starters (webmvc-test, data-jpa-test, cache-test)
- Update @WebMvcTest import to org.springframework.boot.webmvc.test.autoconfigure
- Update @DataJpaTest import to org.springframework.boot.data.jpa.test.autoconfigure
- Add @AutoConfigureCache to slice tests for CacheManager support
- Update Docker images to eclipse-temurin:25-jdk/jre-alpine
- Update GitHub Actions to use JDK 25
@coderabbitai
Copy link

coderabbitai bot commented Dec 3, 2025

Walkthrough

A framework upgrade from Spring Boot 3/JDK 21 to Spring Boot 4/JDK 25, encompassing updates to the parent pom, dependencies (including webmvc and cache starters), base Docker images, CI/CD workflows, documentation, and test annotations.

Changes

Cohort / File(s) Summary
Java Version Configuration
.java-version, .github/workflows/maven.yml, Dockerfile
Updated Java version from 21 to 25; Dockerfile base images changed from eclipse-temurin-21 to eclipse-temurin-25 and maven 3.9 builder stage image updated accordingly.
Build Configuration
pom.xml
Parent pom upgraded from Spring Boot 3.4.4 to 4.0.0; project version updated to 4.0.2025; Java version property set to 25. Dependencies refactored: spring-boot-starter-webspring-boot-starter-webmvc; spring-boot-starter-testspring-boot-starter-webmvc-test; replaced spring-boot-starter-data-jpa with spring-boot-starter-validation. Added new starters: spring-boot-starter-cache, spring-boot-starter-cache-test, spring-boot-starter-data-jpa, spring-boot-starter-data-jpa-test, spring-boot-starter-actuator. Added springdoc-openapi-starter-webmvc-ui, modelmapper, h2, and assertj-core dependencies.
Documentation & CI/CD
.github/copilot-instructions.md, README.md, azure-pipelines.yml
Updated all references from Spring Boot 3/JDK 21 to Spring Boot 4/JDK 25. Azure Pipelines workflow removed entirely. GitHub Actions expectations noted. Documentation updated with new dependency modules, testing annotations (@AutoConfigureCache, @MockitoBean), and environment setup instructions.
Test Annotations
src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/controllers/BooksControllerTests.java, src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/repositories/BooksRepositoryTests.java
Added @AutoConfigureCache annotation to test classes. Replaced @MockBean with @MockitoBean and updated imports to use org.springframework.boot.data.jpa.test.autoconfigure.DataJpaTest and org.springframework.boot.cache.test.autoconfigure.AutoConfigureCache.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • pom.xml: Requires careful verification of dependency restructuring, particularly the migration from spring-boot-starter-web to spring-boot-starter-webmvc and the addition/removal of data-access vs. validation starters; confirm all transitive dependencies remain compatible.
  • Test annotations: Verify that @MockitoBean and @AutoConfigureCache behave identically to the previous @MockBean approach in the test context and that cache auto-configuration does not introduce unexpected side effects.
  • Docker base images: Confirm that the eclipse-temurin-25 image has feature parity with the 21 variant used previously.

Possibly related issues

  • Upgrade to Spring Boot 4.0 and JDK 25 LTS #232: Directly implements the Spring Boot 4 / JDK 25 upgrade as specified, including pom.xml version updates, Docker image changes, test annotation migrations (@MockitoBean, @AutoConfigureCache), and CI/CD workflow adjustments.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and clearly describes the main changes—upgrading to Spring Boot 4.0 and JDK 25 LTS, which aligns with the primary objective across all modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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 copilot/upgrade-spring-boot-4-jdk-25

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.

@nanotaboada nanotaboada linked an issue Dec 3, 2025 that may be closed by this pull request
30 tasks
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 3, 2025

@codacy-production
Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.00% (target: -1.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (6f38258) 55 55 100.00%
Head commit (5936c65) 55 (+0) 55 (+0) 100.00% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#234) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

@codecov
Copy link

codecov bot commented Dec 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (6f38258) to head (5936c65).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##              master      #234   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity        22        22           
===========================================
  Files              2         2           
  Lines             55        55           
  Branches           4         4           
===========================================
  Hits              55        55           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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: 0

🧹 Nitpick comments (3)
src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/repositories/BooksRepositoryTests.java (1)

3-5: Prefer AssertJ over JUnit assertions in repository tests

Given AssertJ is already in use, you can drop the JUnit assertTrue in favor of an AssertJ assertion for consistency with the testing guidelines.

A possible refactor:

-import static org.junit.jupiter.api.Assertions.assertTrue;
@@
-        Optional<Book> actual = repository.findByIsbn(existing.getIsbn());
-        // Assert
-        assertTrue(actual.isPresent());
-        assertThat(actual.get()).usingRecursiveComparison().isEqualTo(existing);
+        Optional<Book> actual = repository.findByIsbn(existing.getIsbn());
+        // Assert
+        assertThat(actual).isPresent();
+        assertThat(actual.get()).usingRecursiveComparison().isEqualTo(existing);

This keeps all assertions in AssertJ and allows you to remove the unused JUnit static import. As per coding guidelines, AssertJ is preferred for fluent assertions in tests.

Also applies to: 35-36

.github/copilot-instructions.md (1)

140-141: Add Mockito/ByteBuddy compatibility troubleshooting to the Troubleshooting section.

If Spring Boot 4.0.0 requires Mockito agent configuration for JDK 25, document this in the Troubleshooting section. Consider adding:

 ### Build Failures
 
+ - **Mockito/ByteBuddy errors in tests**: JDK 25 may require explicit Mockito agent configuration. Add argLine with Mockito agent to maven-surefire-plugin if tests fail with ByteBuddy errors

Also applies to: 209-209

pom.xml (1)

188-192: Remove redundant spring-boot-starter-test dependency.

In Spring Boot 4.0, spring-boot-starter-webmvc-test transitively includes spring-boot-starter-test, making the explicit declaration at lines 188-192 redundant. Remove it to keep the dependency tree clean.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6f38258 and 5936c65.

📒 Files selected for processing (9)
  • .github/copilot-instructions.md (7 hunks)
  • .github/workflows/maven.yml (1 hunks)
  • .java-version (1 hunks)
  • Dockerfile (3 hunks)
  • README.md (5 hunks)
  • azure-pipelines.yml (0 hunks)
  • pom.xml (4 hunks)
  • src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/controllers/BooksControllerTests.java (2 hunks)
  • src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/repositories/BooksRepositoryTests.java (1 hunks)
💤 Files with no reviewable changes (1)
  • azure-pipelines.yml
🧰 Additional context used
📓 Path-based instructions (9)
**/*.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.java: Use JDK 21 (LTS) features where appropriate; do not use JDK 22+ as they cause Mockito/ByteBuddy compatibility issues
Use constructor injection with Lombok @RequiredArgsConstructor for dependency injection
Prefer Lombok annotations (@Data, @RequiredArgsConstructor, @NoArgsConstructor, @AllArgsConstructor) over manual boilerplate code
Use Java Streams API for collection processing instead of imperative loops
Package naming convention: ar.com.nanotaboada.java.samples.spring.boot.<layer>

Files:

  • src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/controllers/BooksControllerTests.java
  • src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/repositories/BooksRepositoryTests.java
**/{controllers,services}/*.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/{controllers,services}/*.java: Use BookDTO for API requests/responses; Book entity is internal and should not be exposed directly
Use section dividers (e.g., /* HTTP POST */) in controllers and services

Files:

  • src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/controllers/BooksControllerTests.java
**/test/**/*Tests.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Name test classes with plural suffix: <ClassName>Tests (e.g., BooksControllerTests)

Files:

  • src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/controllers/BooksControllerTests.java
  • src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/repositories/BooksRepositoryTests.java
**/test/**/*.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/test/**/*.java: Use BDD-style test method naming: given<Condition>_when<Action>_then<Expected>
Use AssertJ fluent assertions (assertThat(...).isEqualTo(...)) instead of standard JUnit assertions
Use @DisplayName for readable test descriptions in test classes
Use test data factories (BookFakes, BookDTOFakes) for consistent test data across tests
Use @MockBean for mocking Spring beans in tests and verify interactions with verify()
Test package naming convention: Insert .test before layer name (e.g., ...samples.spring.boot.test.controllers)

Files:

  • src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/controllers/BooksControllerTests.java
  • src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/repositories/BooksRepositoryTests.java
**/controllers/*.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Annotate REST controller methods with @Operation and @ApiResponses for OpenAPI/Swagger documentation

Files:

  • src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/controllers/BooksControllerTests.java
**/test/controllers/*.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use @WebMvcTest for controller layer tests and MockMvc for HTTP assertions

Files:

  • src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/controllers/BooksControllerTests.java
Dockerfile

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use multi-stage Docker build with Eclipse Temurin Alpine images

Files:

  • Dockerfile
**/repositories/*.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Repository interfaces should extend CrudRepository<Entity, ID> from Spring Data JPA

Files:

  • src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/repositories/BooksRepositoryTests.java
**/test/repositories/*.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use @DataJpaTest for repository layer tests

Files:

  • src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/repositories/BooksRepositoryTests.java
🧠 Learnings (22)
📓 Common learnings
Learnt from: CR
Repo: nanotaboada/java.samples.spring.boot PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T16:16:19.398Z
Learning: Applies to **/*.java : Use JDK 21 (LTS) features where appropriate; do not use JDK 22+ as they cause Mockito/ByteBuddy compatibility issues
📚 Learning: 2025-11-25T16:16:19.398Z
Learnt from: CR
Repo: nanotaboada/java.samples.spring.boot PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T16:16:19.398Z
Learning: Applies to **/*.java : Use JDK 21 (LTS) features where appropriate; do not use JDK 22+ as they cause Mockito/ByteBuddy compatibility issues

Applied to files:

  • .java-version
  • .github/copilot-instructions.md
  • README.md
  • pom.xml
📚 Learning: 2025-11-25T16:16:19.398Z
Learnt from: CR
Repo: nanotaboada/java.samples.spring.boot PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T16:16:19.398Z
Learning: Applies to **/{controllers,services}/*.java : Use `BookDTO` for API requests/responses; `Book` entity is internal and should not be exposed directly

Applied to files:

  • .github/copilot-instructions.md
  • src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/controllers/BooksControllerTests.java
  • README.md
📚 Learning: 2025-11-25T16:16:19.398Z
Learnt from: CR
Repo: nanotaboada/java.samples.spring.boot PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T16:16:19.398Z
Learning: Applies to **/test/**/*.java : Test package naming convention: Insert `.test` before layer name (e.g., `...samples.spring.boot.test.controllers`)

Applied to files:

  • .github/copilot-instructions.md
  • src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/controllers/BooksControllerTests.java
  • README.md
📚 Learning: 2025-11-25T16:16:19.398Z
Learnt from: CR
Repo: nanotaboada/java.samples.spring.boot PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T16:16:19.398Z
Learning: Applies to **/test/controllers/*.java : Use `WebMvcTest` for controller layer tests and `MockMvc` for HTTP assertions

Applied to files:

  • .github/copilot-instructions.md
  • src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/controllers/BooksControllerTests.java
  • README.md
📚 Learning: 2025-11-25T16:16:19.398Z
Learnt from: CR
Repo: nanotaboada/java.samples.spring.boot PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T16:16:19.398Z
Learning: Applies to **/test/**/*.java : Use `MockBean` for mocking Spring beans in tests and verify interactions with `verify()`

Applied to files:

  • .github/copilot-instructions.md
  • src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/controllers/BooksControllerTests.java
  • README.md
📚 Learning: 2025-11-25T16:16:19.398Z
Learnt from: CR
Repo: nanotaboada/java.samples.spring.boot PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T16:16:19.398Z
Learning: Applies to **/test/repositories/*.java : Use `DataJpaTest` for repository layer tests

Applied to files:

  • .github/copilot-instructions.md
  • src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/repositories/BooksRepositoryTests.java
  • README.md
  • pom.xml
📚 Learning: 2025-11-25T16:16:19.398Z
Learnt from: CR
Repo: nanotaboada/java.samples.spring.boot PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T16:16:19.398Z
Learning: Applies to **/test/**/*.java : Use AssertJ fluent assertions (`assertThat(...).isEqualTo(...)`) instead of standard JUnit assertions

Applied to files:

  • .github/copilot-instructions.md
  • README.md
📚 Learning: 2025-11-25T16:16:19.398Z
Learnt from: CR
Repo: nanotaboada/java.samples.spring.boot PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T16:16:19.398Z
Learning: Applies to **/*.java : Prefer Lombok annotations (`Data`, `RequiredArgsConstructor`, `NoArgsConstructor`, `AllArgsConstructor`) over manual boilerplate code

Applied to files:

  • .github/copilot-instructions.md
  • pom.xml
📚 Learning: 2025-11-25T16:16:19.398Z
Learnt from: CR
Repo: nanotaboada/java.samples.spring.boot PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T16:16:19.398Z
Learning: Applies to **/test/**/*.java : Use test data factories (`BookFakes`, `BookDTOFakes`) for consistent test data across tests

Applied to files:

  • .github/copilot-instructions.md
  • src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/controllers/BooksControllerTests.java
  • src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/repositories/BooksRepositoryTests.java
  • README.md
📚 Learning: 2025-11-25T16:16:19.398Z
Learnt from: CR
Repo: nanotaboada/java.samples.spring.boot PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T16:16:19.398Z
Learning: Applies to **/test/**/*Tests.java : Name test classes with plural suffix: `<ClassName>Tests` (e.g., `BooksControllerTests`)

Applied to files:

  • .github/copilot-instructions.md
  • src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/controllers/BooksControllerTests.java
  • src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/repositories/BooksRepositoryTests.java
  • README.md
📚 Learning: 2025-11-25T16:16:19.398Z
Learnt from: CR
Repo: nanotaboada/java.samples.spring.boot PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T16:16:19.398Z
Learning: Applies to **/{controllers,services}/*.java : Use section dividers (e.g., `/* HTTP POST */`) in controllers and services

Applied to files:

  • .github/copilot-instructions.md
📚 Learning: 2025-11-25T16:16:19.398Z
Learnt from: CR
Repo: nanotaboada/java.samples.spring.boot PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T16:16:19.398Z
Learning: Always use Maven wrapper (`./mvnw` on Unix/macOS or `mvnw.cmd` on Windows) instead of system Maven

Applied to files:

  • .github/copilot-instructions.md
📚 Learning: 2025-05-25T20:38:22.964Z
Learnt from: nanotaboada
Repo: nanotaboada/java.samples.spring.boot PR: 185
File: mvnw.cmd:73-78
Timestamp: 2025-05-25T20:38:22.964Z
Learning: Maven Wrapper scripts (mvnw, mvnw.cmd, and related files) are auto-generated using the command `mvn -N wrapper:wrapper -Dmaven=<version>` and should not be modified locally. Any issues should be reported to the upstream Maven Wrapper project rather than fixed in individual repositories.

Applied to files:

  • .github/copilot-instructions.md
📚 Learning: 2025-05-25T20:38:06.232Z
Learnt from: nanotaboada
Repo: nanotaboada/java.samples.spring.boot PR: 185
File: mvnw:63-72
Timestamp: 2025-05-25T20:38:06.232Z
Learning: Maven wrapper scripts (mvnw, mvnw.cmd) in Java projects are typically generated using `mvn -N wrapper:wrapper -Dmaven=<version>` command and should not be manually modified. Issues in these scripts should be reported upstream to the Apache Maven Wrapper project.

Applied to files:

  • .github/copilot-instructions.md
📚 Learning: 2025-05-25T20:38:16.090Z
Learnt from: nanotaboada
Repo: nanotaboada/java.samples.spring.boot PR: 185
File: mvnw:176-180
Timestamp: 2025-05-25T20:38:16.090Z
Learning: Maven wrapper scripts (mvnw, mvnw.cmd) are typically auto-generated using `mvn -N wrapper:wrapper` command and should not be manually modified. Any bugs or issues in these scripts should be reported upstream to the Apache Maven Wrapper project rather than being fixed in individual repositories.

Applied to files:

  • .github/copilot-instructions.md
📚 Learning: 2025-11-25T16:16:19.398Z
Learnt from: CR
Repo: nanotaboada/java.samples.spring.boot PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T16:16:19.398Z
Learning: Applies to Dockerfile : Use multi-stage Docker build with Eclipse Temurin Alpine images

Applied to files:

  • .github/copilot-instructions.md
  • Dockerfile
📚 Learning: 2025-11-25T16:16:19.398Z
Learnt from: CR
Repo: nanotaboada/java.samples.spring.boot PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T16:16:19.398Z
Learning: Applies to {**/Application.java,**/models/**} : Exclude `Application.java` (main class) and `models/**` package from JaCoCo code coverage reporting

Applied to files:

  • .github/copilot-instructions.md
📚 Learning: 2025-11-25T16:16:19.398Z
Learnt from: CR
Repo: nanotaboada/java.samples.spring.boot PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T16:16:19.398Z
Learning: Applies to **/repositories/*.java : Repository interfaces should extend `CrudRepository<Entity, ID>` from Spring Data JPA

Applied to files:

  • src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/repositories/BooksRepositoryTests.java
📚 Learning: 2025-11-25T16:16:19.398Z
Learnt from: CR
Repo: nanotaboada/java.samples.spring.boot PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T16:16:19.398Z
Learning: Applies to **/*.java : Package naming convention: `ar.com.nanotaboada.java.samples.spring.boot.<layer>`

Applied to files:

  • README.md
  • pom.xml
📚 Learning: 2025-11-25T16:16:19.398Z
Learnt from: CR
Repo: nanotaboada/java.samples.spring.boot PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T16:16:19.398Z
Learning: Applies to **/test/**/*.java : Use BDD-style test method naming: `given<Condition>_when<Action>_then<Expected>`

Applied to files:

  • README.md
📚 Learning: 2025-11-25T16:16:19.398Z
Learnt from: CR
Repo: nanotaboada/java.samples.spring.boot PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T16:16:19.398Z
Learning: Applies to **/*.java : Use constructor injection with Lombok `RequiredArgsConstructor` for dependency injection

Applied to files:

  • pom.xml
🧬 Code graph analysis (1)
src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/repositories/BooksRepositoryTests.java (1)
src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/controllers/BooksControllerTests.java (1)
  • DisplayName (36-437)
⏰ 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). (2)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Analyze (java-kotlin)
🔇 Additional comments (12)
src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/controllers/BooksControllerTests.java (3)

16-23: New WebMvc/cache test imports look consistent with Spring Boot 4 slices

The switch to org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest, org.springframework.boot.cache.test.autoconfigure.AutoConfigureCache, and org.springframework.test.context.bean.override.mockito.MockitoBean matches the modular test starters described in the PR and looks coherent for Boot 4 slice tests.

Please just confirm that the corresponding WebMvc/cache/Mockito test starters are on the classpath and that the whole test suite passes under JDK 25.


37-39: Class-level @AutoConfigureCache is a good fit for this WebMvc slice

Enabling @AutoConfigureCache at the controller slice level makes sense given the cache-test starter and keeps cache configuration aligned with how the app is wired.

Verify that this does not accidentally pull in any unwanted cache infrastructure for WebMvc tests (e.g., if you later add multiple cache managers).


46-50: Confirm @MockitoBean is the new project standard for controller mocks

Using @MockitoBean for BooksService and BooksRepository in this WebMvc test should continue to provide Mockito-based mocks, but it does change semantics compared to the older @MockBean approach referenced in the current guidelines.

Given the existing guidance to use @MockBean in tests, please confirm that:

  • The team intends to standardize on @MockitoBean for Spring Boot 4, and
  • Project documentation/guidelines are updated accordingly so future tests follow the same pattern.
    Based on learnings, the guidelines still mention @MockBean, so aligning them with this change will avoid confusion.
src/test/java/ar/com/nanotaboada/java/samples/spring/boot/test/repositories/BooksRepositoryTests.java (2)

12-14: Updated JPA test and cache imports match Spring Boot 4 test configuration

Using org.springframework.boot.data.jpa.test.autoconfigure.DataJpaTest together with org.springframework.boot.cache.test.autoconfigure.AutoConfigureCache is consistent with the Boot 4 modular test setup and the cache-test starter added in this PR.

Please confirm that the new data-jpa-test and cache-test starters are present in the build so these imports resolve cleanly under JDK 25.


19-22: @AutoConfigureCache on repository slice keeps cache behavior consistent

Adding @AutoConfigureCache to BooksRepositoryTests mirrors the controller tests and should ensure repository-level behavior is tested with the same cache configuration.

Double-check that this doesn’t unintentionally mask cache-related issues (e.g., if production config differs from the default cache auto-config) and that it aligns with how you expect repositories to be cached in the app.

.github/workflows/maven.yml (1)

16-16: Consider adding explicit Mockito agent configuration for JDK 25 tests.

Starting with Java 21, Maven's Surefire plugin should be configured to load the Mockito agent explicitly to ensure test compatibility with newer Java versions. If test failures occur related to Mockito/ByteBuddy, add Mockito agent configuration to the Maven Surefire plugin in pom.xml.

Monitor the test runs in this workflow to detect any Mockito-related failures. If tests fail with ByteBuddy errors, apply this configuration to pom.xml:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <configuration>
    <argLine>-javaagent:${settings.localRepository}/org/mockito/mockito-core/${mockito.version}/mockito-core-${mockito.version}.jar</argLine>
  </configuration>
</plugin>
Dockerfile (1)

5-5: Docker base images correctly updated to JDK 25.

Multi-stage build with Eclipse Temurin Alpine images follows best practices. Base image updates from JDK 21 to 25 are consistent across builder and runtime stages.

Also applies to: 22-22

README.md (1)

10-10: Documentation accurately reflects Spring Boot 4 and JDK 25 upgrade.

All prerequisite and setup instructions have been updated consistently to target JDK 25. Test structure documentation now mentions @AutoConfigureCache and @MockitoBean, aligning with Spring Boot 4.0's modular test starters.

Also applies to: 29-29, 69-69, 77-77

.github/copilot-instructions.md (1)

92-92: Remove or qualify the JDK 25 feature recommendation pending Mockito compatibility verification.

Line 92 recommends leveraging JDK 25 features, but the retrieved learnings explicitly warn against using JDK 22+ due to Mockito/ByteBuddy compatibility issues. Update this guidance to conditional based on the outcome of the JDK 25 / Mockito compatibility verification.

Suggested update:

- **Modern Java**: Leverage JDK 25 features (records, pattern matching, sealed classes, etc.) where beneficial
+ **Modern Java**: Leverage JDK 25 features where beneficial; note JDK 25/Mockito compatibility (see Troubleshooting section)
pom.xml (2)

9-18: Approve Spring Boot 4.0.0 upgrade structure and modular dependency organization.

The migration from Spring Boot 3.4.4 to 4.0.0 is well-executed with proper modular starter structure (webmvc, cache, data-jpa) and corresponding test starters. Comments documenting each section and linking to Maven Repository are helpful for future maintenance.


16-16: Spring Boot 4.0.0 already manages compatible Byte Buddy and Mockito versions for Java 25—no override needed.

Spring Boot 4.0.0 declares first-class support for Java 25 and transitively manages Byte Buddy 1.17.8 and Mockito 5.20.0, both of which support Java 25 without issues. No explicit dependency override is required.

.java-version (1)

1-1: No action required—JDK 25 is fully supported.

Spring Boot 4.0.0 explicitly supports JDK 25 and includes compatible Mockito/ByteBuddy versions in its dependency management. The upgrade is valid and requires no changes.

Likely an incorrect or invalid review comment.

Copilot finished reviewing on behalf of nanotaboada December 3, 2025 03:41

This comment was marked as outdated.

@nanotaboada nanotaboada merged commit c50e42f into master Dec 3, 2025
23 checks passed
@nanotaboada nanotaboada deleted the copilot/upgrade-spring-boot-4-jdk-25 branch December 3, 2025 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade to Spring Boot 4.0 and JDK 25 LTS

2 participants