Skip to content

Migrate Spring Boot application from Java 11 to Java 17#8

Open
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
devin/1768839460-java17-migration
Open

Migrate Spring Boot application from Java 11 to Java 17#8
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
devin/1768839460-java17-migration

Conversation

@devin-ai-integration
Copy link
Copy Markdown

Migrate Spring Boot application from Java 11 to Java 17

Summary

This PR migrates the RealWorld Spring Boot application from Java 11 to Java 17, including upgrading Spring Boot from 2.6.3 to 3.1.5 and all related dependencies.

Key changes:

  • Java version: 11 → 17
  • Spring Boot: 2.6.3 → 3.1.5
  • Gradle: 7.4 → 8.4
  • MyBatis: 2.2.2 → 3.0.3
  • Netflix DGS: 4.9.21 → 8.1.1
  • Jakarta EE namespace migration (javax.*jakarta.*)
  • Spring Security 6 refactoring (removed WebSecurityConfigurerAdapter, using SecurityFilterChain bean)
  • GraphQL PageInfo type conversion updated for DGS 8.x compatibility

Review & Testing Checklist for Human

  • Security configuration: Verify the refactored WebSecurityConfig.java maintains the same authorization rules - the migration from antMatchers to requestMatchers and the new lambda-based configuration style could have subtle differences
  • GraphQL pagination: The PageInfo type was changed from graphql.relay.DefaultPageInfo to io.spring.graphql.types.PageInfo in both ArticleDatafetcher and CommentDatafetcher - test GraphQL queries with pagination (first/after, last/before)
  • REST API endpoints: Test key endpoints manually:
    • POST /users and POST /users/login (authentication)
    • GET /articles and GET /articles/feed (authorization rules)
    • POST /articles (validation with Jakarta)
  • Exception handling: The CustomizeExceptionHandler.handleMethodArgumentNotValid signature changed from HttpStatus to HttpStatusCode - verify validation errors return proper 422 responses

Recommended test plan:

  1. Run ./gradlew bootRun and verify app starts on http://localhost:8080
  2. Test REST API: curl http://localhost:8080/tags
  3. Test GraphQL: Access http://localhost:8080/graphiql and run a query with pagination
  4. Test authentication flow end-to-end

Notes

All 68 existing tests pass locally with Java 17. The core business logic, domain entities, and database schema remain unchanged.

Link to Devin run: https://app.devin.ai/sessions/c10f6a129af1420e921722b51f1f2100
Requested by: @SachetCognition

- Update Java version to 17 in build.gradle
- Upgrade Spring Boot from 2.6.3 to 3.1.5
- Upgrade dependency-management from 1.0.11.RELEASE to 1.1.3
- Update MyBatis Spring Boot Starter from 2.2.2 to 3.0.3
- Update Netflix DGS Framework to 8.1.1 with platform BOM
- Update DGS codegen plugin to 6.0.3
- Update rest-assured testing dependencies to 5.3.2
- Update Gradle wrapper from 7.4 to 8.4
- Migrate javax imports to jakarta namespace (validation, servlet)
- Refactor WebSecurityConfig to use SecurityFilterChain bean approach
- Update antMatchers to requestMatchers for Spring Security 6
- Fix CustomizeExceptionHandler for Spring Boot 3 API changes
- Fix PageInfo type conversion in GraphQL datafetchers
- Update GitHub Actions workflow to use Java 17

All 68 existing tests pass with the migration.

Co-Authored-By: sachet.agarwal@windsurf.com <sachet.agarwal@windsurf.com>
@devin-ai-integration
Copy link
Copy Markdown
Author

Original prompt from sachet.agarwal
# Migrate Spring Boot RealWorld Application from Java 11 to Java 17

## Repository
`SachetCognition/spring-boot-realworld-example-app`

## Background
This is a Spring Boot 2.6.3 application currently running on Java 11 that implements a RealWorld social blogging platform with both REST and GraphQL APIs. The application uses:
- Spring Boot 2.6.3
- MyBatis 2.2.2 for data access
- Netflix DGS Framework 4.9.21 for GraphQL
- JWT for authentication
- SQLite database
- Flyway for migrations
- Gradle as the build system

The application follows Domain-Driven Design (DDD) principles with a layered architecture and implements CQRS pattern.

## Task
Migrate the application from Java 11 to Java 17 while preserving all business and technical functionalities.

## Required Changes

### 1. Update Java Version in `build.gradle`
Locate lines 10-11 in `build.gradle` and update:
```gradle
sourceCompatibility = '17'
targetCompatibility = '17'

2. Upgrade Spring Boot Version in build.gradle

Locate lines 2-3 in build.gradle and update to Spring Boot 3.x series (which supports Java 17):

id 'org.springframework.boot' version '3.1.5'
id 'io.spring.dependency-management' version '1.1.3'

3. Update Dependencies in build.gradle

Update the following dependencies to be compatible with Spring Boot 3 and Java 17:

  • MyBatis Spring Boot Starter: Upgrade to version 3.0.3 (currently at 2.2.2 on line 38)
  • Netflix DGS Framework: Upgrade to latest compatible version (currently at 4.9.21 on line 39)
  • Update all testing dependencies for Spring Boot 3 compatibility

4. Jakarta EE Namespace Migration

Spring Boot 3 uses Jakarta EE instead of javax. Search the entire codebase and update all imports:

  • javax.servletjakarta.servlet
  • javax.validationjakarta.validation
  • javax.persistencejakarta.persistence

5. Update Security Configuration in src/main/java/io/spring/api/security/WebSecurityConfig.java

The WebSecurityConfigurerAdapter is deprecated... (1964 chars truncated...)

</details>

@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

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