Token导航 LogoToken导航TokenDH.com
研究检索external-servicegithub未标认证来源可访问许可证需确认审计提醒

spring-boot-4-migrationSpring Boot 4 迁移

Agent Skill

用于辅助 Java 项目开发、面向对象设计、Spring 生态、Maven 或 Gradle 依赖和后端工程实践。它适合让 Agent 分析类结构、设计接口、整理服务分层、生成测试或检查常见代码坏味道。使用时需要结合项目已有架构、包结构和依赖版本,不应只按通用教程改代码;涉及数据库、事务、并发或框架配置时,应先确认运行环境和回归测试范围。

总安装

309

周安装

13

GitHub Stars

35

下载量

108
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:spring-boot-4-migration(Spring Boot 4 迁移)
来源仓库:https://github.com/adityamparikh/spring-boot-4-migration-skill
仓库路径:skills/spring-boot-4-migration
安装命令:
npx skills add https://github.com/adityamparikh/spring-boot-4-migration-skill --skill spring-boot-4-migration
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/adityamparikh/spring-boot-4-migration-skill --skill spring-boot-4-migration

简介

帮助将现有 Spring Boot 项目平滑升级到 4.x 版本的迁移工具集。

  • 适用于需要适配 Jakarta EE 命名空间与移除过时 API 的项目。
  • 提供自动化检测脚本与渐进式重构步骤建议。spring-boot-4-migration 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 重大 API 变更处需人工复核替换方案的正确性。
  • 迁移后务必运行完整回归测试套件保障功能完整性。

SKILL.md

Spring Boot 4 Migration Skill

Migrate Spring Boot 3.x applications to 4.x and stay current across minor versions with zero guesswork.

Scope: 3.x → 4.0 and 4.x Minor Versions

This skill covers two scenarios:

  1. Major migration (3.x → 4.0): The bulk of this skill — all 9 phases, the gradual upgrade strategy, and the bridge system.
  2. Minor version upgrades (4.0 → 4.1, 4.1 → 4.2, etc.): Tracked in references/minor-version-changes.md. Minor versions may deprecate APIs, remove compatibility bridges, change defaults, and introduce new features. Check that file before bumping to any new 4.x minor version.

Verify Library and Framework Usage

The model's training data has a knowledge cutoff. During migration, actively verify that APIs, configurations, and patterns are current for the target Spring Boot version:

  1. Identify versions — Check pom.xml or build.gradle.kts to determine the exact versions of Spring Boot, Spring Framework, and all key dependencies (both source and target).
  2. Look up current documentation — Use Context7 (mcp__claude_ai_Context7__resolve-library-id then mcp__claude_ai_Context7__query-docs) to retrieve up-to-date documentation for any library or framework where:

- The version is newer than what the model may have been trained on - You are unsure whether an API, configuration property, or pattern is still valid or has been deprecated/replaced - The migration involves advanced or less common features of a library

  1. Search the web — Use WebSearch and WebFetch to check for:

- Breaking changes or migration guides for the specific version in use - Known security vulnerabilities (CVEs) in the dependency versions - Deprecated APIs that have been replaced in newer versions - Community-reported migration issues and workarounds

  1. Check GitHub — Use gh CLI to check release notes, changelogs, or issues for dependencies when needed (e.g., gh api repos/spring-projects/spring-boot/releases/latest)

Do not assume that an API or pattern is correct based solely on model knowledge. When in doubt, look it up. This is especially critical during major version migrations where many APIs change.

Toolchain Version Check (Do This First)

Before starting any migration, detect the project's current Java, Kotlin, Maven, and Gradle versions. If any are below the minimum supported versions, upgrade them BEFORE proceeding with the Spring Boot migration.

Minimum supported versions for Spring Boot 4.x:

ToolMinimumRecommendedHow to check
Java1721+ (25 supported)java -version or javac -version
Kotlin2.22.2.x (latest)Check kotlin.version in build file or kotlinc -version
Maven3.6.33.9.x+mvn -version or ./mvnw -version
Gradle8.149.xgradle -version or ./gradlew -version

If older versions are detected:

  • Java < 17: Upgrade JDK before anything else. Boot 4 will not compile. Install JDK 21 (LTS, recommended) or JDK 17 (minimum). Update JAVA_HOME, sourceCompatibility/targetCompatibility (Gradle), or <maven.compiler.source>/<maven.compiler.target> (Maven).
  • Kotlin < 2.2: Update kotlin.version property in your build file to 2.2.x. Spring Boot 4 requires Kotlin 2.2 baseline for JSpecify null-safety support. If upgrading from Kotlin 1.x, review the Kotlin 2.0 migration guide first.
  • Maven < 3.6.3: Upgrade Maven wrapper: mvn wrapper:wrapper -Dmaven=3.9.9 or download a newer distribution. Older Maven versions may fail to resolve Boot 4 dependencies or run the Boot Maven plugin.
  • Gradle < 8.14: Upgrade Gradle wrapper: ./gradlew wrapper --gradle-version=9.0 (or 8.14 minimum). Older Gradle versions are not supported by the Spring Boot 4 Gradle plugin.

Action: Run the version checks above. Resolve any version gaps, then confirm the project still compiles and tests pass before continuing.

Prerequisites

For 3.x → 4.0 migration:

  • Toolchain versions meet minimums (see Toolchain Version Check above)
  • Source project compiles and tests pass on Spring Boot 3.5.x (latest patch)
  • Java 17+ is available (Java 21+ recommended, Java 25 supported)
  • All deprecated API calls from Boot 3.x are resolved where possible
  • If on Boot 3.4 or earlier, first upgrade to 3.5.x before proceeding

For 4.x → 4.y minor version upgrade:

  • Project is on the latest patch of the current minor version (e.g., 4.0.x latest)
  • Review references/minor-version-changes.md for the target version
  • Check the official release notes for the target version
  • Resolve any deprecation warnings from the current version

Choose Your Migration Strategy

Strategy 1 — Gradual Upgrade (Recommended for enterprise/large codebases) Read references/gradual-upgrade-strategy.md FIRST. This models migration as a dependency graph: a Day-1 baseline using compatibility bridges, then 6 independent tracks (Starters, Jackson 3, Properties, Security, Testing, Framework 7) completed at your own pace. Key bridges:

  • spring-boot-starter-classic — restores 3.x monolithic auto-configuration
  • spring-boot-jackson2 — keeps Jackson 2 code working alongside Boot 4
  • spring-security-access — bridges legacy AccessDecisionManager/Voter Use this when: multiple teams, many services, phased rollouts, or when complete Jackson 3 / Security 7 migration will take more than one sprint.

Strategy 2 — All-at-Once (below) Execute all 9 phases sequentially in one effort. Best for greenfield projects, small codebases, or single-team ownership.

Automated Migration with OpenRewrite

Before doing manual migration, consider using OpenRewrite recipes to automate the mechanical changes. The Moderne platform and OpenRewrite project provide recipes for:

  • Jackson 2 → 3 package/import migration: org.openrewrite.java.jackson.UpgradeJackson_2_3
  • Spring Boot 4.x upgrade: org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_5 (prepare step), then UpgradeSpringBoot_4_0
  • @MockBean@MockitoBean annotation replacement

Run OpenRewrite FIRST to handle bulk find-replace operations, then use this skill's phases to address the remaining manual changes (Security DSL rewrites, behavioral differences, property semantics, etc.).

See: https://www.moderne.ai/blog/spring-boot-4x-migration-guide

Migration Workflow (All-at-Once)

Execute these phases IN ORDER. Each phase must compile and pass tests before proceeding to the next.

Phase 1: Build File Migration

Update Boot/Framework versions, build plugins, and replace deprecated starters with modular equivalents. Add modular test starters for each technology used in tests. Use classic starters as a stopgap if needed.

Read references/build-and-dependencies.md for complete starter mappings, build plugin changes, and step-by-step instructions.

Compile check: Run mvn compile or gradle compileJava — fix any dependency resolution errors before continuing.

Phase 2: Property Migration

Scan all application.properties, application.yml, profile-specific variants, and @SpringBootTest(properties =...) annotations. Rename changed property keys (Jackson, MongoDB, session, actuator, Hibernate).

Read references/property-changes.md for the complete property mapping.

Phase 3: Jackson 3 Migration

Jackson 3 is the default in Boot 4. Migrate group IDs, packages, and renamed Boot classes (@JsonComponent@JacksonComponent, etc.). Use spring-boot-jackson2 bridge as a temporary stopgap if needed.

Read references/jackson3-migration.md for complete details.

Phase 4: Package and API Relocations

Fix relocated imports (@EntityScan, BootstrapRegistry, etc.), removed APIs (PropertyMapper.alwaysApplyingNotNull, path matching options), and deprecated converters. Also migrate HTTP client code if applicable.

Read references/api-changes.md for the full list of relocated packages and removed APIs. Also read references/http-clients.md if your project uses RestClient, WebClient, @HttpExchange, or Feign.

Phase 5: Observability Migration

Replace individual Micrometer/OTel dependencies with the consolidated spring-boot-starter-opentelemetry starter, update OTLP properties, and rename observability modules. Actuator is now optional for OTel export.

Read references/observability-migration.md for complete details.

Phase 6: Spring Security 7 Migration

Migrate to Security 7 DSL (lambda-only, no and()), replace removed AuthorizationManager#check, switch to PathPatternRequestMatcher, and update Jackson/SAML integrations. Use spring-security-access bridge if legacy AccessDecisionManager/Voter code cannot migrate immediately.

Read references/spring-security7.md for complete details.

Phase 7: Testing Infrastructure Migration

Replace @MockBean/@SpyBean with @MockitoBean/@MockitoSpyBean (removed, not just deprecated). Add explicit auto-configure annotations for test HTTP clients. Migrate Testcontainers 2 module names/packages and adopt JUnit 6. Add modular test starters for each technology.

Read references/testing-migration.md for complete details.

Phase 8: Spring Framework 7 Specific Changes

Address JSpecify nullability (Kotlin impact), deprecated AntPathMatcher, MVC XML config removal, SpringExtension scope changes, Hibernate 7.1 entity mapping changes, and Spring Retry → Framework core retry migration.

Read references/spring-framework7.md for complete details. Also read references/resilience-migration.md if your project uses Spring Retry, @Retryable, @ConcurrencyLimit, or Resilience4j. Optionally read references/api-versioning.md for new API versioning capabilities introduced in Framework 7.

Phase 9: Final Verification

Run the verification script if available, otherwise manually check:

  1. mvn clean verify or gradle clean build — full compile + tests
  2. Verify application starts: mvn spring-boot:run or gradle bootRun
  3. Check actuator health: curl localhost:8080/actuator/health
  4. Verify liveness/readiness probes (now enabled by default)
  5. Check structured logging output format
  6. Run integration tests against each active Spring profile
  7. Verify Docker image builds if using buildpacks or Jib

Optionally read references/aot-native.md if you plan to adopt AOT processing, GraalVM native images, or the new AOT cache feature.

Minor Version Upgrades (4.0 → 4.1, 4.1 → 4.2, etc.)

When upgrading between Spring Boot 4.x minor versions, follow this process:

1. Check What Changed

Read references/minor-version-changes.md for the target version. Also consult the official release notes:

2. Bridge Removal Awareness

Minor versions are where compatibility bridges get removed. Before upgrading, check whether any bridges you depend on are being dropped:

BridgeIntroducedExpected Removal
spring-boot-jackson24.04.1 or 4.2
spring-boot-starter-classic4.05.0
spring-boot-starter-test-classic4.05.0
Deprecated starter names4.05.0

If you are still using a bridge that is being removed in the target version, complete the corresponding migration track BEFORE upgrading.

3. Upgrade Process

  1. Update the Spring Boot version in your build file to the target minor version's latest patch release.
  2. Run mvn compile / gradle compileJava — fix any new compilation errors.
  3. Run the full test suite — fix any test failures.
  4. Review deprecation warnings in both build output and application logs. These signal what will break in the NEXT minor version.
  5. Run verify_migration.sh to confirm migration state.

4. New Features

Each minor version introduces new features and auto-configurations. These are opt-in and don't require action, but you may want to adopt them. Check the "New and Noteworthy" section of each release's notes.

Troubleshooting

Common Compilation Errors

ErrorCauseFix
ClassNotFoundException:...autoconfigure...Modular starters neededAdd specific spring-boot-starter-X
NoSuchMethodError: PropertyMapper.alwaysApplyingNotNullAPI removedUse always() instead
Cannot resolve symbol JsonComponentRenamedUse @JacksonComponent
Package com.fasterxml.jackson does not existJackson 3 packagesChange to tools.jackson
Cannot resolve symbol MockBeanDeprecated/removedUse @MockitoBean
ClassNotFoundException: RestClientBuilderCustomizerElasticsearch changeUse Rest5ClientBuilderCustomizer

Quick Fixes

  • If build won't compile at all after version bump, use spring-boot-starter-classic and spring-boot-starter-test-classic to get running, then incrementally migrate to modular starters. See references/gradual-upgrade-strategy.md for the full Day-1 baseline.
  • If Jackson 3 migration is blocking, add spring-boot-jackson2 temporarily. This is a first-class bridge — see Track B in the gradual strategy.
  • If Spring Security changes are extensive, add spring-security-access bridge and upgrade to Security 6.5 preparation steps first (they provide opt-out flags for 7.0 breaking changes). See Track D in the gradual strategy.
  • For enterprise rollouts across many services, use the Wave 1-4 approach in references/gradual-upgrade-strategy.md to minimize blast radius.

Reference File Index

FileWhen to read
references/gradual-upgrade-strategy.mdFIRST — migration dependency graph, bridges, independent tracks, enterprise rollout
references/build-and-dependencies.mdPhase 1 / Track A — full starter mapping tables, build plugin changes
references/property-changes.mdPhase 2 / Track C — all property key renames and value changes
references/jackson3-migration.mdPhase 3 / Track B — Jackson 3 packages, APIs, compatibility mode
references/api-changes.mdPhase 4 — package relocations, removed APIs, renamed classes
references/observability-migration.mdPhase 5 — OpenTelemetry starter, OTLP properties, module renames, Actuator decoupling
references/spring-security7.mdPhase 6 / Track D — Security 7 breaking changes and DSL migration
references/testing-migration.mdPhase 7 / Track E — MockBean, Testcontainers 2, JUnit 6, RestTestClient
references/spring-framework7.mdPhase 8 / Track F — Framework 7 changes, JSpecify, path matching
references/http-clients.mdHTTP clients — RestClient, WebClient, @HttpExchange, Feign migration, RestTestClient
references/api-versioning.mdAPI versioning — strategies, semantic ranges, client-side, deprecation, testing
references/resilience-migration.mdResilience — Spring Retry → Framework 7, @Retryable, @ConcurrencyLimit, Resilience4j
references/aot-native.mdAOT/Native — BeanRegistrar, RuntimeHints, Spring Data AOT, GraalVM 25, AOT Cache
references/minor-version-changes.md4.x minor upgrades — changes per minor version, bridge removals, new features
scripts/verify_migration.shPhase 9 — bridge-aware verification with PASS/FAIL/WARN/BRIDGE

Official Sources

Cross-reference with these authoritative resources:

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.04%
按下载量换算38

Claude

30.26%
按下载量换算33

Cursor

18.59%
按下载量换算20

Gemini CLI

9.06%
按下载量换算10

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

external-service

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills