Skip to content

Upgrade to Java 25 and Spring Boot 3.5; modernize code#11

Open
devin-ai-integration[bot] wants to merge 2 commits into
masterfrom
devin/1776785076-java-25-upgrade
Open

Upgrade to Java 25 and Spring Boot 3.5; modernize code#11
devin-ai-integration[bot] wants to merge 2 commits into
masterfrom
devin/1776785076-java-25-upgrade

Conversation

@devin-ai-integration
Copy link
Copy Markdown

Summary

Upgrades the project from Java 8 / Spring Boot 2.0.2 (2018) to Java 25 (LTS) / Spring Boot 3.5.0, and batches in a set of correctness, modernization, and hygiene improvements.

Build & dependencies

  • pom.xml: parent spring-boot-starter-parent 2.0.2.RELEASE3.5.0; <java.version> 1.825; maven.compiler.release=25.
  • Drop obsolete spring-boot-properties-migrator (it was a 1.x→2.x aid).
  • Add spring-boot-starter-actuator, spring-boot-starter-test, springdoc-openapi-starter-webmvc-ui (Swagger UI at /swagger-ui.html).
  • Remove the duplicate Gradle build (build.gradle, gradle/, gradlew, gradlew.bat) — Maven is now the single build tool.
  • Project coordinates changed: org.springframework:gs-spring-boot:0.1.0 (pom)hello:springboot-java-modern:1.0.0 (jar).

Correctness / behavior

  • Remove the hard-coded call to http://gturnquist-quoters.cfapps.io/api/random in Application.main and the old CommandLineRunner (PWS was retired in 2023; this would fail on startup).
  • TopicService.getTopicWithId now returns Optional<Topic>; controller throws ResponseStatusException(NOT_FOUND) → proper 404 instead of a 500 NoSuchElementException.
  • Guard the H2-seeding CommandLineRunner with @ConditionalOnBean(JdbcTemplate.class) so slice tests don't need a DataSource.
  • Replace the mutable ArrayList of topics with CopyOnWriteArrayList for thread-safety; getAllTopics() returns an immutable copy.

Modernization

  • DTOs → record: Topic, Greeting, Quote, Value, Customer.
  • Controllers: @RequestMapping@GetMapping/@PostMapping/@PutMapping/@DeleteMapping; @RequestMapping("/topic") hoisted to class level; constructor injection replaces @Autowired fields; @ResponseStatus on create/delete.
  • TopicService uses List.of, method references, Pattern#asMatchPredicate, Stream#toList.
  • HelloController uses a text block + String#formatted.
  • Adjusted demo file-ops endpoint to operate on pom* / README.md now that grad* and temp.txt no longer exist.

Tests & CI

  • Added TopicServiceTest (11 unit tests), TopicControllerTest (5 @WebMvcTest MockMvc tests), ApplicationTests context-load smoke test. Local mvn verify: 17/17 passing.
  • New .github/workflows/ci.yml running ./mvnw -B -ntp verify on Temurin JDK 25.

Hygiene

  • Expand .gitignore (target/, build/, .idea/, *.iml, .vscode/, …).
  • Untrack target/, .idea/, gs-spring-boot.iml, stray .gitignore.txt, root-level application.properties, temp.txt.
  • README refreshed (prereqs, ./mvnw commands, Swagger/Actuator URLs).

Review & Testing Checklist for Human

  • Wire format parity for Topic — the model is now a record, so Jackson serializes id/subjectName/subjectDescription via record accessors. POST a topic and GET it back; the JSON field names should match the pre-PR shape (I did not find any consumers that relied on get* setters, but please double-check).
  • Spring Boot 3 namespace / behavior changes — no explicit javax.* usages were found in this codebase, but please skim the runtime logs after ./mvnw spring-boot:run for any deprecation/config-migration warnings.
  • Behavior of demo endpoints that read files/topic/file/operation now searches for pom* instead of grad* and reads README.md instead of the deleted temp.txt. Confirm that's acceptable (these are demo endpoints, not user-facing).
  • Artifact coordinates changegroupId/artifactId/version went from org.springframework:gs-spring-boot:0.1.0 to hello:springboot-java-modern:1.0.0. Confirm nothing external consumes the published artifact under the old coords.
  • CI run on JDK 25 — Temurin 25 is selected via actions/setup-java; verify the runner has it available (this is new enough that it's worth a sanity check on the first green run).

Notes

  • Spring Boot 3.4 was tried first but its bundled ASM does not support class-file major version 69 (Java 25); bumped to 3.5.0 which does.
  • Out of scope (flagged as possible follow-ups): replace the in-memory topics list with JPA + H2 (the deps are already pulled in), containerize with a Dockerfile/buildpacks, Micrometer/Prometheus observability.

Link to Devin session: https://app.devin.ai/sessions/36c4f507879e4903a73800cd780af6bd
Requested by: @bnob-git

- Java 8 -> Java 25 (LTS), Spring Boot 2.0.2 -> 3.5.0

- Remove legacy Gradle config (keep Maven)

- Drop obsolete spring-boot-properties-migrator

- Add Spring Boot Actuator and springdoc-openapi

- Convert DTOs to records (Topic, Greeting, Value, Customer, Quote)

- Switch to specific HTTP mappings (@GetMapping/@PostMapping/...)

- Constructor injection; RequestMapping base path on TopicController

- Fix NPE in getTopicWithId: return Optional, 404 via ResponseStatusException

- CopyOnWriteArrayList for thread-safe in-memory store; immutable getAllTopics

- Remove dead gturnquist-quoters.cfapps.io REST call from Application

- Guard JDBC CommandLineRunner with @ConditionalOnBean(JdbcTemplate.class)

- Add JUnit 5 tests (TopicService + TopicController @WebMvcTest + context)

- Add GitHub Actions CI on JDK 25

- Hygiene: expand .gitignore; remove IDE/.iml/target/.idea; refresh README

Co-Authored-By: Bobby Nobakht <bobby.nobakht@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

Co-Authored-By: Bobby Nobakht <bobby.nobakht@cognition.ai>
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