Skip to content

Migrate to Spring Boot 3.3.5 / Java 21#24

Open
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1778072426-springboot3-java21-migration
Open

Migrate to Spring Boot 3.3.5 / Java 21#24
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1778072426-springboot3-java21-migration

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot commented May 6, 2026

Summary

Modernizes the project from Spring Boot 2.0.2.RELEASE / Java 8 to Spring Boot 3.3.5 / Java 21, following the step-by-step plan in the task brief.

Build configuration

  • pom.xml: change <packaging> from pom to jar, bump spring-boot-starter-parent to 3.3.5, set <java.version> to 21, drop the legacy spring-boot-properties-migrator dependency. spring-boot-starter-web, spring-boot-starter-jdbc, and h2 are kept (versions managed by parent).
  • build.gradle: bump spring-boot-gradle-plugin to 3.3.5, set sourceCompatibility/targetCompatibility to 21, replace compile/testCompile with implementation/testImplementation, switch bootJar to archiveBaseName/archiveVersion, and add spring-boot-starter-jdbc + h2 so the Gradle build matches the Maven dependency set (Application.java uses JdbcTemplate).

Build wrappers

  • Maven wrapper distribution → apache-maven-3.9.9.
  • Gradle wrapper distribution → gradle-8.10.
  • mvnw and gradlew are now executable (mode 755).

Application code

  • Application.java:
    • Fix H2 2.x syntax: DROP TABLE IF EXISTS customers (the legacy DROP TABLE customers IF EXISTS is no longer supported by H2 shipped with Spring Boot 3.x).
    • Replace deprecated new Object[]{"Josh"} parameter style on jdbcTemplate.query with the varargs form (RowMapper before varargs).
    • Remove dead http://gturnquist-quoters.cfapps.io/api/random RestTemplate calls (the Cloud Foundry endpoint has been shut down) — both the call in main() and the CommandLineRunner run(RestTemplate) bean.
  • Drop the now-unused Quote and Value model classes.
  • Convert Greeting to a Java 21 record (Jackson serializes record components by name, so the / greeting JSON shape is preserved).
  • All other model classes (Topic, Customer) and controllers/services are unchanged.

No javax.* imports are present in src/, so no jakarta namespace migration is needed.

Documentation

  • README.md updated to reflect Java 21, Spring Boot 3.3.x, the removal of the dead Quote endpoint, and Maven/Gradle run instructions.

Review & Testing Checklist for Human

  • Run ./mvnw clean package on JDK 21 and confirm a green build.
  • Run ./gradlew build on JDK 21 and confirm a green build.
  • Boot the jar (java -jar target/gs-spring-boot-0.1.0.jar) and verify the H2 customers seed runs without errors and that Querying for customer records where first_name = 'Josh' logs both Josh entries.
  • Smoke-test the documented endpoints (GET /, GET /topic, GET /topic/{id}, POST/PUT/DELETE /topic, GET /datetime, GET /topic/string/operation, GET /topic/file/operation, GET /topic/sort).
  • Confirm Greeting JSON shape on GET / is still {"id":..., "content":"..."} after the record conversion.

Notes

  • target/ is checked in to the repo but I deliberately did not commit any rebuilt class files — the binary churn from Java 21 / Spring Boot 3 recompilation is unrelated to the migration intent. Consider gitignoring target/ and build/ in a follow-up.
  • CustomPredicate<T> is intentionally kept as a demo of a custom functional interface, even though it is structurally identical to java.util.function.Predicate<T>.
  • Maven and Gradle builds were both run locally on JDK 21 (openjdk 21.0.10) and succeeded; the application also boots and seeds H2 successfully.

Link to Devin session: https://app.devin.ai/sessions/906b71cd4d9c4840b92df2db907eb1f9
Requested by: @lburgers


Devin Review

Status Commit
⚪ Not started

Run Devin Review

💡 Connect your GitHub account to enable automatic code reviews.

Open in Devin Review (Staging)
Open in Devin Review

- Bump spring-boot-starter-parent and spring-boot-gradle-plugin to 3.3.5
- Update java.version / sourceCompatibility / targetCompatibility to 21
- Maven: change packaging from pom to jar, drop spring-boot-properties-migrator
- Gradle: replace deprecated compile/testCompile with implementation/testImplementation,
  use bootJar archiveBaseName/archiveVersion, add spring-boot-starter-jdbc and h2
- Bump Maven wrapper to 3.9.9 and Gradle wrapper to 8.10
- Application.java: fix H2 2.x DROP TABLE IF EXISTS syntax, switch jdbcTemplate.query
  to varargs parameter style, remove dead gturnquist-quoters.cfapps.io REST calls
- Convert Greeting model to a Java 21 record
- Remove unused Quote and Value model classes
- Refresh README for Java 21 / Spring Boot 3.3.x

Co-Authored-By: Lukas Burger <lukaskburger@gmail.com>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Copy Markdown
Author

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@devin-ai-integration
Copy link
Copy Markdown
Author

Test results — all 4 tests passed

Booted the migrated jar locally on JDK 21, exercised every documented endpoint plus Topic CRUD, and verified the boot-time H2 seed.

  • It should serialize the Greeting record as {id, content}passed
  • It should seed three topics and look them up by id — passed
  • It should support Topic CRUD via POST/PUT/DELETE — passed
  • It should serve /datetime, /topic/string/operation, /topic/sortpassed
  • /topic/file/operationuntested (out of scope; depends on cwd of the running jar — irrelevant to the migration risk surface)
Startup log evidence (proves the H2 fix and dead-URL removal)
:: Spring Boot ::                (v3.3.5)
hello.Application : Starting Application v0.1.0 using Java 21.0.10 with PID 9200
hello.Application : Started Application in 2.285 seconds (process running for 2.773)
hello.Application : Inserting customer record for John Woo
hello.Application : Inserting customer record for Jeff Dean
hello.Application : Inserting customer record for Josh Bloch
hello.Application : Inserting customer record for Josh Long
hello.Application : Querying for customer records where first_name = 'Josh':
hello.Application : Customer{id=3, firstName='Josh', lastName='Bloch'}
hello.Application : Customer{id=4, firstName='Josh', lastName='Long'}

grep -i "gturnquist\|ResourceAccessException" /tmp/app.log returned no matches — confirming the dead Cloud-Foundry RestTemplate calls were really removed.

If DROP TABLE customers IF EXISTS (legacy syntax) had still been in place, H2 2.x would have thrown JdbcSQLSyntaxErrorException instead of producing the four Inserting customer record … lines. If the deprecated new Object[]{"Josh"} jdbcTemplate.query form had still been in place, Spring Boot 3.x's JdbcTemplate would have thrown IllegalArgumentException instead of the two Customer{… firstName='Josh' …} lines.

UI evidence (one screenshot per assertion)
Assertion Screenshot
🟢 GET /{"id":1,"content":"Hello, World!"} (record JSON shape preserved) Greeting record GET /
🟢 GET /topic → 3 seeded topics: spring, java, javascript GET /topic
🟢 GET /topic/java → exact JSON for the java topic GET /topic/java
🟢 After POST /topic, list contains 4 topics including go POST /topic effect
🟢 After PUT /topic/go, GET /topic/go shows Go 1.23 / Updated PUT /topic/go effect
🟢 GET /datetime text contains the expected markers GET /datetime
🟢 GET /topic/string/operation includes spring:java:javascript join GET /topic/string/operation
🟢 GET /topic/sortjava, javascript, spring GET /topic/sort

Devin session: https://app.devin.ai/sessions/906b71cd4d9c4840b92df2db907eb1f9

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.

1 participant