Skip to content

Migrate from Java 8 to Java 15 with Spring Boot 2.7.18#14

Open
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1777040298-java15-migration
Open

Migrate from Java 8 to Java 15 with Spring Boot 2.7.18#14
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1777040298-java15-migration

Conversation

@devin-ai-integration
Copy link
Copy Markdown

Summary

Migrates the project from Java 8 / Spring Boot 2.0.2 to Java 15 / Spring Boot 2.7.18, incorporating patterns and fixes from existing branch submissions (daniella/migrate-java11, devin/*-java11-upgrade, devin/*-fix-build-and-startup, devin/*-java17-springboot3-migration).

Build & Dependency Changes

  • Spring Boot: 2.0.2.RELEASE → 2.7.18
  • Java version: 1.8 → 15
  • Packaging: pomjar (was preventing executable JAR builds)
  • Maven: Added maven-compiler-plugin with <release>15</release>; wrapper updated to 3.9.6
  • Gradle: Plugin → 2.7.18; compileimplementation, testCompiletestImplementation; baseNamearchiveBaseName; added missing spring-boot-starter-jdbc and h2 deps; wrapper updated to 7.6.4
  • Wrappers: gradlew and mvnw made executable

Java 15 Code Modernization

  • Text blocks (JEP 378): SQL DDL in Application.java, response templates in HelloController.java
  • var (JEP 286): Local variable type inference throughout Application, TopicService, HelloController
  • List.of(): Replaced Arrays.asList() for immutable list creation
  • Path.of(): Replaced Paths.get() (preferred since Java 11)
  • Method references: Topic::getId instead of topic -> topic.getId()

Bug Fixes (from submissions)

  • Defunct external API URL http://gturnquist-quoters.cfapps.iohttps://dummyjson.com/quotes/random
  • Added null checks and try-catch for external REST calls
  • Fixed getTopicWithId to use .orElse(null) instead of bare .get()

Review & Testing Checklist for Human

  • Verify the text blocks in HelloController produce the same output format as before (line continuation \\ chars preserve single-line output)
  • Run mvn clean package with JDK 15+ and confirm the JAR is built successfully
  • Start the app and test the /topic, /datetime, /topic/string/operation endpoints with Postman
  • Confirm the external quote API (https://dummyjson.com/quotes/random) response deserializes correctly into the Quote model (field names may differ)

Notes

  • The spring-boot-properties-migrator dependency is retained since it was in the original pom.xml
  • Both Maven and Gradle builds verified locally (Maven with JDK 21 + --release 15, Gradle with JDK 17 targeting 15)
  • Java 15 is not an LTS release; if a longer support horizon is needed, consider targeting Java 17 instead

Link to Devin session: https://app.devin.ai/sessions/3597c03ca6f14b8484baf92832364cc8
Requested by: @parkerduff

Build & Dependency Changes:
- Update Spring Boot 2.0.2 -> 2.7.18
- Update Java version 1.8 -> 15
- Fix packaging from pom to jar
- Add maven-compiler-plugin with release 15
- Update Gradle plugin to 2.7.18, compile->implementation, testCompile->testImplementation
- Update baseName->archiveBaseName in Gradle bootJar
- Update Maven wrapper to 3.9.6, Gradle wrapper to 7.6.4
- Make gradlew/mvnw executable

Code Modernization (Java 15 features):
- Use text blocks for multi-line strings (SQL, response templates)
- Use var for local variable type inference
- Replace Arrays.asList() with List.of()
- Replace Paths.get() with Path.of()
- Use method references where possible (Topic::getId)

Bug Fixes (from branch submissions):
- Fix defunct external API URL (cfapps.io -> dummyjson.com)
- Add null safety and try-catch for external API calls
- Fix getTopicWithId to use orElse(null) instead of bare get()

README updated to reflect Java 15.

Co-Authored-By: parker.duff@codeium.com <pwjduff@gmail.com>
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.

0 participants