Modernize Spring Boot project: Java 8 → 21, Spring Boot 2.x → 3.4.5#8
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
Modernize Spring Boot project: Java 8 → 21, Spring Boot 2.x → 3.4.5#8devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Phase 1: Upgrade Java 21, Spring Boot 3.4.5, Gradle 8.12, Maven 3.9.9 Phase 2: Remove dead gturnquist-quoters API calls, fix H2 SQL, constructor injection Phase 3: Replace @RequestMapping with specific HTTP method annotations Phase 4: Fix unsafe Optional.get(), add loggers, @FunctionalInterface Phase 5: Convert Greeting and Customer to Java records Phase 6: Move application.properties to src/main/resources Phase 7: Add GlobalExceptionHandler with @ControllerAdvice Phase 8: Add JUnit 5 unit tests for services and controllers Phase 9: Clean up .iml, .idea/, .gitignore, temp.txt Co-Authored-By: Bobby Nobakht <bobby.nobakht@cognition.ai>
Author
🤖 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:
|
Author
End-to-End Test ResultsRan the app locally with Endpoint Tests (7/7 passed)
ScreenshotsGET / — Greeting record JSON serializationGET /?name=DevinGET /topic — Topic listGET /topic/java — Single topic lookupGET /topic/nonexistent — 404 error handlingGET /datetime |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Full modernization of the Spring Boot demo project from Java 8 / Spring Boot 2.0.2 to Java 21 / Spring Boot 3.4.5, along with code quality improvements and new test coverage.
Version upgrades: Java 8→21, Spring Boot 2.0.2→3.4.5, Gradle 4.6→8.12, Maven 3.3.9→3.9.9. Both
pom.xmlandbuild.gradleupdated consistently.build.gradlerewritten to modern plugin DSL.Dead code removal: Removed broken
gturnquist-quoters.cfapps.ioREST calls (service is offline) and associatedRestTemplatebean/imports fromApplication.java. Removed bean inspection loop frommain().Code quality:
@Autowiredfield injection → constructor injection;@RequestMapping→ specific@GetMapping/@PostMapping/etc.TopicService: unsafeOptional.get()→orElseThrow()with descriptive messageTopicService/TimeClient:System.out.println/System.err.println→ SLF4J loggerCustomPredicate: added@FunctionalInterfaceGreetingandCustomer: converted to Java recordsDROP TABLE customers IF EXISTS→DROP TABLE IF EXISTS customersNew files:
GlobalExceptionHandler(@ControllerAdvice),application.propertiesinsrc/main/resources/, three JUnit 5 test files (19 tests total).Cleanup: Deleted
.idea/,.iml,.gitignore.txt; fixed.gitignore; movedtemp.txttosrc/main/resources/.Review & Testing Checklist for Human
Greetingrecord serialization: The class was converted to a Java record. Records exposeid()notgetId(), but Spring Boot 3.x Jackson should serialize them identically. ConfirmGET /still returns{"id": ..., "content": ...}(not differently-named fields) by actually running the app.Quote.javaandValue.javaare now dead code: The REST calls that used them were removed, but the model files themselves were left in the codebase. Decide if these should be deleted.readFileWithStreamFunctionuses a fragile relative path (Paths.get("src/main/resources/temp.txt")): This works when the working directory is the project root, but will break if the app is run from a packaged JAR. Consider loading via classpath resource instead../mvnw spring-boot:runand manually test endpoints:GET /,GET /topic,GET /datetime. The tests are unit/slice tests only — there is no@SpringBootTestintegration test verifying the full context loads with H2.Notes
@WebMvcTestcontroller tests require a@MockitoBean JdbcTemplatebecauseApplication(the@SpringBootApplicationclass) hasJdbcTemplateas a constructor dependency. This is functional but unusual — a cleaner pattern would be to extract theCommandLineRunnerlogic into a separate@Component.packaginginpom.xmlchanged frompomtojar— this was necessary for the Spring Boot Maven plugin to produce a runnable JAR.Link to Devin session: https://app.devin.ai/sessions/c47e2bfdd24f46e3bb7a955a0d906f66
Requested by: @bnob-git