Skip to content

Java 21 migration — Application.java source changes#21

Merged
devin-ai-integration[bot] merged 1 commit into
devin/1777913688-java21-migration-basefrom
devin/1777913912-java21-source-changes
May 4, 2026
Merged

Java 21 migration — Application.java source changes#21
devin-ai-integration[bot] merged 1 commit into
devin/1777913688-java21-migration-basefrom
devin/1777913912-java21-source-changes

Conversation

@devin-ai-integration
Copy link
Copy Markdown

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

Summary

Source-only changes to src/main/java/hello/Application.java to make it compatible with Spring Boot 3.2.5 / Java 21 / H2 2.x. No build or wrapper files are touched in this PR — those are owned by sibling child sessions on the parent migration branch.

Three changes:

  1. H2 2.x SQL syntaxDROP TABLE customers IF EXISTSDROP TABLE IF EXISTS customers. H2 2.x (which ships with Spring Boot 3.x) requires standard SQL syntax for DROP TABLE IF EXISTS.
  2. Deprecated JdbcTemplate.query() overload — switched from the (sql, Object[] args, RowMapper) form to the varargs-last form (sql, RowMapper, Object... args). The boxed-array overload was deprecated in Spring 5 / removed in Spring 6.
  3. Defunct external URLhttp://gturnquist-quoters.cfapps.io/api/random (both occurrences) replaced with https://jsonplaceholder.typicode.com/posts/1. The original quotes service is dead. Still using RestTemplate (no swap to RestClient), call signatures unchanged. The placeholder response shape will not deserialize into Quote, but logging the result is acceptable for a stub — runtime behavior is intentionally degraded; the goal here is just that the build compiles and the URL is reachable.

Also verified: grep -rn 'import javax\.' src/main/java/hello/ returns no matches, so no javax.*jakarta.* rewrites were needed in the source tree.

The base branch for this PR is devin/1777913688-java21-migration-base (the integration branch where pom/gradle/wrapper changes from sibling sessions land), NOT master.

Review & Testing Checklist for Human

  • Confirm the JdbcTemplate.query() varargs reordering still compiles cleanly once Spring Boot 3.2.5 is on the classpath (this child session does not run the build — that happens on the integration PR).
  • Confirm that logging a Quote deserialized from jsonplaceholder.typicode.com/posts/1 is acceptable as a stub (fields will be null / it may throw at deserialization depending on Quote's shape — the parent task explicitly accepts this).
  • Sanity-check that no other call sites in src/main/java/hello/ rely on the old H2 syntax or deprecated JdbcTemplate.query() overload.

Notes

  • Scope per parent session spec: Java source only. pom.xml, build.gradle, .mvn/wrapper/maven-wrapper.properties, and gradle/wrapper/gradle-wrapper.properties are intentionally untouched.
  • Lint and tests are not run in this child session — they run on the integration PR.

Link to Devin session: https://app.devin.ai/sessions/5e67b22183e34041a60eec70211d1af4
Requested by: @dr-phil


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

- Fix H2 2.x DROP TABLE syntax (DROP TABLE IF EXISTS customers)
- Update deprecated JdbcTemplate.query() to varargs overload
- Replace defunct gturnquist-quoters URL with jsonplaceholder placeholder

Co-Authored-By: Phil Bedford <phil.bedford@cognition.ai>
@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

@devin-ai-integration devin-ai-integration Bot merged commit 218ecee into devin/1777913688-java21-migration-base May 4, 2026
1 check was pending
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 found 1 potential issue.

View 3 additional findings in Devin Review.

Open in Devin Review


RestTemplate restTemplate = new RestTemplate();
Quote quote = restTemplate.getForObject("http://gturnquist-quoters.cfapps.io/api/random", Quote.class);
Quote quote = restTemplate.getForObject("https://jsonplaceholder.typicode.com/posts/1", Quote.class);
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

🔴 API response schema mismatch: Quote model fields will all be null when deserializing JSONPlaceholder response

The new URL https://jsonplaceholder.typicode.com/posts/1 returns a JSON object with fields userId, id, title, and body, but the Quote model (hello/model/Quote.java) expects type (String) and value (Value object with id and quote sub-fields). Since none of the JSON fields match, Jackson will silently ignore them (Spring Boot defaults FAIL_ON_UNKNOWN_PROPERTIES to false), and the deserialized Quote will have type=null and value=null. The log.info(quote.toString()) at line 40 will print Quote{type='null', value=null} — the REST call is effectively useless. The same issue applies to the CommandLineRunner bean at line 52-53.

Prompt for agents
The Quote model (hello/model/Quote.java) has fields `type` (String) and `value` (Value), where Value (hello/model/Value.java) has fields `id` (Long) and `quote` (String). The new endpoint https://jsonplaceholder.typicode.com/posts/1 returns JSON with fields userId, id, title, body — none of which map to Quote's fields. Either: (1) update the Quote and Value model classes to match the JSONPlaceholder response schema, (2) find a replacement API that returns data matching the existing Quote model, or (3) create a new model class (e.g. Post) with userId, id, title, body fields and use that instead. The same URL is used in two places: the main() method at line 39 and the CommandLineRunner bean at line 53.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Acknowledged — this schema mismatch is intentional and explicitly in-scope per the parent migration spec, not a bug to fix in this PR.

From the parent session's task spec for this child:

Note: the response shape will not deserialize into Quote, but logging the result is acceptable for the placeholder; do NOT change the Quote model class. The goal here is just that the build compiles and the URL is reachable; runtime behavior is intentionally a stub.

This is also already called out in the PR description's "Review & Testing Checklist":

Confirm that logging a Quote deserialized from jsonplaceholder.typicode.com/posts/1 is acceptable as a stub (fields will be null / it may throw at deserialization depending on Quote's shape — the parent task explicitly accepts this).

So: yes, Quote{type='null', value=null} is the expected runtime behavior post-migration. The original gturnquist-quoters.cfapps.io quotes service is dead, and finding/standing up a real replacement (or refactoring to a Post model + new endpoint) is deliberately deferred — the migration's goal here was just compile + reachable URL. Picking a real replacement endpoint or model is a separate follow-up.

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