# Spring Boot 4 Upgrade: OpenRewrite + Post-Migration Fixer

> Upgrade Spring Boot 3.x to 4 with OpenRewrite, then fix the compile and test errors the recipe leaves behind.

Spring Boot 4 Upgrade: OpenRewrite + Post-Migration Fixer is a paid AI agent skill on Agensi by Max P., in LLM Ops. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $18.99 (one-time purchase)
- Creator: [Max P.](https://www.agensi.io/creators/midi)
- Category: [LLM Ops](https://www.agensi.io/skills/llm-ops)
- Version: 1.0
- Last updated: 2026-10-07
- Security: scan passed (2026-10-07); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/spring-boot-4-upgrade-openrewrite-post-migration-fixer
- Tags: llm-ops, devops, code-review, java, spring-boot, maven, gradle, openrewrite

## About this skill

Upgrading to Spring Boot 4 is more than a version bump. Modular auto-configuration, Jackson 3, Spring Framework 7, Hibernate 7, and the new test-starter split break builds in ways the OpenRewrite recipe alone does not fix.
This skill makes your coding agent work through the migration step by step, with checks along the way:

- Checks preconditions first: Boot 3.x, Java 17+, Gradle/Maven version, JDK compatibility, Java toolchain, Kotlin 2.2+, clean git tree, feature branch, green build.
- Fixes known bad patterns before the rewrite, so the recipe doesn't leave them half-migrated.
- Runs the official OpenRewrite Spring Boot 4.0 recipe. It uses a non-invasive Gradle init script (no build-file edits) or a one-line Maven command. It prefers the wrapper and handles Windows/PowerShell quoting.
- Pins OpenRewrite versions that resolve from Maven Central. Newer OpenRewrite releases are moving to an authenticated repository and fail with Could not find org.openrewrite:rewrite-bom. The skill avoids this and explains the fallback.
- Finds your internal libraries, corporate parent POMs, and convention plugins, and asks you for their Spring Boot 4–compatible versions. It never guesses.
- Includes a catalogue of 25+ real post-migration errors with before/after fixes, covering:

- **o**: modular starters (security, OAuth2, Kafka, Liquibase, WebMVC tests)

- **o**: Jackson 2 → 3 (customizers, serializationInclusion, visibility, JsonNullable)
- **o**: RestClient message converters
- **o**: HttpHeaders no longer being a Map
- **o**: @AutoConfigureObservability, Micrometer package moves
- **o**: TestRestTemplate, MockMvc, and WebTestClient annotations; @Mock fields no longer initialised
- **o**: Specification.unrestricted(), Hibernate 5 package removal
- **o**: the OpenAPI generator (the recipe's version bump is too old to work)
- **o**: OkHttp MockWebServer 3, Resilience4J in slice tests
- **o**: Undertow removal
- **o**: and more
- Catches what the recipe gets wrong: Spring Boot versions left on 3.x in Gradle version catalogs, stale version pins that override the Spring Cloud BOM, and hard-coded versions it adds.
- Runs your formatter after the rewrite (spring-javaformat, Spotless, ktlint), so formatter checks don't break the build.
- Optional second step from 4.0 to the latest 4.x release.
- Doesn't loop on slow builds: it stops and asks after two failed attempts on an unknown error.
- Never commits. It pauses at five checkpoints so you can review and commit each phase separately.
- Writes sb4-migration-report.md listing what changed, temporary measures to revert, remaining TODO-SB4 markers, new issues, and a suggested commit plan.

Tested end to end on six projects (Spring Boot 3.4/3.5 → 4.0.8), each ending with a green full build and all tests passing:

- spring-petclinic with Maven and with Gradle (Groovy DSL)
- spring-petclinic-rest (Maven, OpenAPI generator, Spring Security, Jackson customisation, 216 tests)
- spring-petclinic-microservices (Maven, 9 modules, Spring Cloud 2025.1, gateway, Resilience4J, OkHttp MockWebServer)
- spring-petclinic-kotlin (Kotlin 2.3, Gradle Kotlin DSL)
- a Gradle Kotlin DSL multi-module build with a version catalog and FAIL_ON_PROJECT_REPOS

It was also used by the author on internal production Gradle services.
The catalogue's code fixes were also applied verbatim to a purpose-built project, then compiled and tested on Spring Boot 4. Where the maintainers of these projects had published their own Spring Boot 4 upgrade, the skill's result was compared with theirs.
What it can't do for you: it can't guess compatible versions of your private/internal libraries (it asks), and very unusual setups may still need a human for a few errors. The skill stops and tells you instead of looping.
Invoke it with /upgrade-spring-boot-4 or just ask your agent to "upgrade this project to Spring Boot 4". It changes nothing until it has checked the preconditions and you have said "continue".
Licensing note: this skill uses the OpenRewrite rewrite-spring recipe. Your own build downloads the recipe under its own licence (Moderne Source Available License), and you run it on your own code. This skill contains no OpenRewrite or recipe code. Spring and Spring Boot are trademarks of Broadcom Inc. OpenRewrite is a trademark of Moderne, Inc. This skill is not affiliated with or endorsed by either.

## Known limitations

**What's inside**
- `SKILL.md`: the workflow with 5 review checkpoints, preconditions, version pins, recovery table, guardrails
- `references/known-issues.md`: 25+ pre/post-migration fixes (Jackson 3, modular starters, Spring Cloud 2025.1, OpenAPI generator, MockWebServer 3, Hibernate 5 removal, Resilience4J, version catalogs, …)
- `references/report-template.md`: structure of the migration report
- `references/upgrade-to-latest-4x.md`: optional step to the newest 4.x
- `assets/rewrite-init.gradle`: runs OpenRewrite on Gradle without editing your build files

**Tested on** spring-petclinic (Maven and Gradle), petclinic-rest (216 tests), petclinic-microservices (9 modules, Spring Cloud), petclinic-kotlin (Gradle KTS), and a Gradle KTS multi-module build with a version catalog. All ended with a green build.

**Updates:** free updates for buyers. The catalogue grows with every reported issue.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Spring Boot 4 Upgrade: OpenRewrite + Post-Migration Fixer skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### How does this skill differ from just running a standard OpenRewrite recipe?

Standard OpenRewrite recipes often leave projects in a non-compiling state due to breaking changes in Jackson 3, Hibernate 7, and Spring Framework 7; this skill bridges that gap by identifying and fixing 25+ specific post-migration errors that automated recipes typically miss.

### Which AI agents and project environments are supported?

The skill is designed for any coding agent with file-system and terminal access (such as Cursor, Windsurf, or GitHub Copilot) that supports Maven or Gradle environments running Java 17+ and Spring Boot 3.x.

### Will this skill break my custom Gradle Version Catalog or multi-module setup?

No, the skill specifically handles complex build configurations like Gradle Version Catalogs, convention plugins, and multi-module Maven projects, manually prompt-testing for internal library versions instead of guessing.

### Does the agent automatically commit changes to my repository?

The skill includes a pre-migration checklist and five distinct review checkpoints where it pauses for your feedback, ensuring no code is committed until you have manually verified the changes.

### What specific migration fixes are included beyond the version bump?

Beyond the automated rewrite, you get a comprehensive catalogue of real-world fixes for Spring Security, OAuth2, MockMvc, and message converters, plus a generated migration report detailing all TODOs and new dependencies.

### What happens if the agent encounters a compilation error it doesn't recognize?

The skill is designed to stop and ask for human intervention after two failed attempts on an unknown error, preventing expensive LLM loops and ensuring you remain in control of the migration logic.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
