From 5365828264d72445a9b84501d72f6ddca96b0139 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Mon, 11 May 2026 21:18:55 +0000 Subject: [PATCH 1/2] Migrate to Java 17 and Spring Boot 3.2.5 - Bump Java version from 1.8 to 17 in pom.xml, build.gradle, and gs-spring-boot.iml - Bump Spring Boot from 2.0.2.RELEASE to 3.2.5 (Maven parent and Gradle plugin) - Remove spring-boot-properties-migrator (1.x->2.x migration helper, no longer needed) - Update Maven wrapper to apache-maven 3.9.6 - Update Gradle wrapper to gradle 8.7 - Use modern Gradle 'implementation'/'testImplementation' (compile/testCompile removed) - Rename bootJar 'baseName' to 'archiveBaseName' for Gradle 8 compatibility - Add spring-boot-starter-jdbc and h2 to Gradle deps so it matches Maven and Application.java compiles - Fix H2 DDL syntax: 'DROP TABLE customers IF EXISTS' -> 'DROP TABLE IF EXISTS customers' - Replace deprecated JdbcTemplate.query(sql, Object[], RowMapper) with varargs overload Co-Authored-By: sophia.lyssy --- .mvn/wrapper/maven-wrapper.properties | 2 +- build.gradle | 14 ++++++++------ gradle/wrapper/gradle-wrapper.properties | 2 +- gs-spring-boot.iml | 2 +- pom.xml | 9 ++------- src/main/java/hello/Application.java | 7 ++++--- 6 files changed, 17 insertions(+), 19 deletions(-) diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index c954cec..4465bd9 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip +distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip diff --git a/build.gradle b/build.gradle index 09f1083..433b7c4 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ buildscript { mavenCentral() } dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.2.RELEASE") + classpath("org.springframework.boot:spring-boot-gradle-plugin:3.2.5") } } @@ -14,7 +14,7 @@ apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' bootJar { - baseName = 'gs-spring-boot' + archiveBaseName = 'gs-spring-boot' version = '0.1.0' } @@ -22,11 +22,13 @@ repositories { mavenCentral() } -sourceCompatibility = 1.8 -targetCompatibility = 1.8 +sourceCompatibility = 17 +targetCompatibility = 17 dependencies { - compile("org.springframework.boot:spring-boot-starter-web") - testCompile("junit:junit") + implementation("org.springframework.boot:spring-boot-starter-web") + implementation("org.springframework.boot:spring-boot-starter-jdbc") + runtimeOnly("com.h2database:h2") + testImplementation("junit:junit") } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a2ff3cc..51ff6a3 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip diff --git a/gs-spring-boot.iml b/gs-spring-boot.iml index ad195a8..828c1b0 100644 --- a/gs-spring-boot.iml +++ b/gs-spring-boot.iml @@ -1,6 +1,6 @@ - + diff --git a/pom.xml b/pom.xml index 63f5cbd..2d4d1be 100644 --- a/pom.xml +++ b/pom.xml @@ -11,15 +11,10 @@ org.springframework.boot spring-boot-starter-parent - 2.0.2.RELEASE + 3.2.5 - - org.springframework.boot - spring-boot-properties-migrator - runtime - org.springframework.boot spring-boot-starter-web @@ -35,7 +30,7 @@ - 1.8 + 17 diff --git a/src/main/java/hello/Application.java b/src/main/java/hello/Application.java index 7cf8faf..7d0da60 100644 --- a/src/main/java/hello/Application.java +++ b/src/main/java/hello/Application.java @@ -63,7 +63,7 @@ public CommandLineRunner run(RestTemplate restTemplate) throws Exception { public void run(String... args) throws Exception { log.info("Creating tables"); - jdbcTemplate.execute("DROP TABLE customers IF EXISTS"); + jdbcTemplate.execute("DROP TABLE IF EXISTS customers"); jdbcTemplate.execute("CREATE TABLE customers(id SERIAL, first_name VARCHAR(255), last_name VARCHAR(255))"); // Split up the array of whole names into an array of first/last names @@ -80,8 +80,9 @@ public void run(String... args) throws Exception { log.info("Querying for customer records where first_name = 'Josh':"); jdbcTemplate.query( - "SELECT id, first_name, last_name FROM customers WHERE first_name = ?", new Object[]{"Josh"}, - (rs, rowNum) -> new Customer(rs.getLong("id"), rs.getString("first_name"), rs.getString("last_name")) + "SELECT id, first_name, last_name FROM customers WHERE first_name = ?", + (rs, rowNum) -> new Customer(rs.getLong("id"), rs.getString("first_name"), rs.getString("last_name")), + "Josh" ).forEach(customer -> log.info(customer.toString())); } From 47f4e2b872b3a4f1af059f752bb348a2c09e210d Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Mon, 11 May 2026 21:25:10 +0000 Subject: [PATCH 2/2] Make dead demo quote URL fetch non-fatal The hard-coded http://gturnquist-quoters.cfapps.io URL is no longer reachable. Wrap both call sites in try/catch so the failed fetch only logs a warning instead of aborting Spring Boot startup, which was preventing the migrated app from serving any endpoints. Co-Authored-By: sophia.lyssy --- src/main/java/hello/Application.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/java/hello/Application.java b/src/main/java/hello/Application.java index 7d0da60..612eaa7 100644 --- a/src/main/java/hello/Application.java +++ b/src/main/java/hello/Application.java @@ -36,8 +36,12 @@ public static void main(String[] args) { } RestTemplate restTemplate = new RestTemplate(); - Quote quote = restTemplate.getForObject("http://gturnquist-quoters.cfapps.io/api/random", Quote.class); - log.info(quote.toString()); + try { + Quote quote = restTemplate.getForObject("http://gturnquist-quoters.cfapps.io/api/random", Quote.class); + log.info(quote.toString()); + } catch (Exception e) { + log.warn("Skipping demo quote fetch: {}", e.getMessage()); + } } @@ -49,9 +53,13 @@ public RestTemplate restTemplate(RestTemplateBuilder builder) { @Bean public CommandLineRunner run(RestTemplate restTemplate) throws Exception { return args -> { - Quote quote = restTemplate.getForObject( - "http://gturnquist-quoters.cfapps.io/api/random", Quote.class); - log.info(quote.toString()); + try { + Quote quote = restTemplate.getForObject( + "http://gturnquist-quoters.cfapps.io/api/random", Quote.class); + log.info(quote.toString()); + } catch (Exception e) { + log.warn("Skipping demo quote fetch: {}", e.getMessage()); + } }; }