Migrate to Spring Boot 3.3.5 / Java 21#24
Conversation
- 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 EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Test results — all 4 tests passedBooted the migrated jar locally on JDK 21, exercised every documented endpoint plus Topic CRUD, and verified the boot-time H2 seed.
Startup log evidence (proves the H2 fix and dead-URL removal)
If UI evidence (one screenshot per assertion)Devin session: https://app.devin.ai/sessions/906b71cd4d9c4840b92df2db907eb1f9 |
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>frompomtojar, bumpspring-boot-starter-parentto3.3.5, set<java.version>to21, drop the legacyspring-boot-properties-migratordependency.spring-boot-starter-web,spring-boot-starter-jdbc, andh2are kept (versions managed by parent).build.gradle: bumpspring-boot-gradle-pluginto3.3.5, setsourceCompatibility/targetCompatibilityto21, replacecompile/testCompilewithimplementation/testImplementation, switchbootJartoarchiveBaseName/archiveVersion, and addspring-boot-starter-jdbc+h2so the Gradle build matches the Maven dependency set (Application.java usesJdbcTemplate).Build wrappers
apache-maven-3.9.9.gradle-8.10.mvnwandgradleware now executable (mode 755).Application code
Application.java:DROP TABLE IF EXISTS customers(the legacyDROP TABLE customers IF EXISTSis no longer supported by H2 shipped with Spring Boot 3.x).new Object[]{"Josh"}parameter style onjdbcTemplate.querywith the varargs form (RowMapper before varargs).http://gturnquist-quoters.cfapps.io/api/randomRestTemplatecalls (the Cloud Foundry endpoint has been shut down) — both the call inmain()and theCommandLineRunner run(RestTemplate)bean.QuoteandValuemodel classes.Greetingto a Java 21record(Jackson serializes record components by name, so the/greeting JSON shape is preserved).Topic,Customer) and controllers/services are unchanged.No
javax.*imports are present insrc/, so no jakarta namespace migration is needed.Documentation
README.mdupdated 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
./mvnw clean packageon JDK 21 and confirm a green build../gradlew buildon JDK 21 and confirm a green build.java -jar target/gs-spring-boot-0.1.0.jar) and verify the H2 customers seed runs without errors and thatQuerying for customer records where first_name = 'Josh'logs both Josh entries.GET /,GET /topic,GET /topic/{id},POST/PUT/DELETE /topic,GET /datetime,GET /topic/string/operation,GET /topic/file/operation,GET /topic/sort).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 gitignoringtarget/andbuild/in a follow-up.CustomPredicate<T>is intentionally kept as a demo of a custom functional interface, even though it is structurally identical tojava.util.function.Predicate<T>.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