All jobs

Upgrade Spring Boot 2.6 to Spring Boot 4

An agent takes a Spring Boot 2.6 app through 2.7 and 3.5 to 4.0.9, fixes two bugs the move exposed, and keeps all 68 tests passing.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

The agent installs a Temurin JDK 17, since the sandbox had none, runs ./gradlew test on the untouched clone, then upgrades in three steps with the tests after each: 2.6.3 to 2.7.18, to 3.5.16 (Gradle 8.14.3, Java 17, javax to jakarta, a SecurityFilterChain bean replacing WebSecurityConfigurerAdapter), and to 4.0.9 (renamed starters, @MockitoBean, Jackson 3 in JacksonCustomizations and ErrorResourceSerializer).

Boot 4 first failed 28 tests. JwtTokenFilter was registered both as a servlet filter bean and in the security chain, and the servlet copy's authentication was discarded, so signed-in requests got 401. The global UNWRAP_ROOT_VALUE setting also broke POST /graphql; six request DTOs now wrap with @JsonTypeInfo instead.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "Upgrade this app from Spring Boot 2.6 to Spring Boot 4 following the official upgrade guide step by step. Run the tests after each step and fix what breaks. Open a pull request that lists each change and anything you left for a person to decide.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

Tried on gothinkster/spring-boot-realworld-example-app at ee17e31: 43 files changed, 356 insertions(+), 295 deletions(-), in five local commits. ./gradlew test --no-daemon exited 0 before (BUILD SUCCESSFUL in 1m 18s, 68 tests, 0 failures). After the upgrade, the last spotlessApply test run passed tests=68 skipped=0 failures=0 errors=0, the final test was up to date (5 actionable tasks: 5 up-to-date), and spotlessCheck exited 0. On bootRun, register, login, article, comment and a GraphQL articles query answered 200 or 201, an invalid registration got 422, and GET /user without a token got 401. The run copied two diffs to /workspace/.rush/artifacts/; capture keeps no .diff file, so neither came back. No pull request was opened.

For the reviewer: DGS is pinned to 11.1.0 because 12.x needs a json-path Boot 4.0.9 does not manage, and the target is 4.0.9 although 4.1.2 is published; the run tried neither alternative.

Run it on every Monday morning, then switch it off

An automation with the recipe's schedule trigger, cron 0 9 * * 1, and this prompt runs the upgrade the next Monday. A move to Boot 4 is a one-time job, not a weekly bump: switch the automation off after that run, because a second run would start the whole upgrade again.

The use case this job follows, with its automation and trigger: Upgrade dependencies weekly.

Why run it on Rush?

The tests missed one break: the GraphQL tests call DgsQueryExecutor directly, so the 400 from POST /graphql showed only when the agent ran the upgraded app and sent real requests. The 401s came from a filter registered twice, which only broke under Boot 4, where the servlet copy ran first.

Frequently asked questions

What did the run leave alone?

jjwt 0.11.2, joda-time and sqlite-jdbc 3.36 were not upgraded. Deprecation warnings under Boot 4 were not reviewed, and only one GraphQL operation was tried over HTTP.

Does the app still run on Java 11?

No. Boot 4 needs Java 17, so build.gradle targets 17 and the README now says Java 17 or newer. The run tested on JDK 17 only.

The same job on other stacks

More jobs like this: Upgrade dependencies weekly

Keep reading