Spring Boot 3.5

When upgrading to Spring Boot 3.5, refer to the Spring Boot 3.5 Release Notes to find out about newly introduced APIs, deprecated APIs, and information about breaking changes.

The io.arconia.rewrite.spring.boot.UpgradeSpringBoot_3_5 recipe automates most of the changes introduced in Spring Boot 3.5. You can use it to update your project to the latest Spring Boot 3.5.x release.

The recipe will:

  • Upgrade all org.springframework.boot dependencies, the spring-boot-starter-parent Maven parent, and the Spring Boot Gradle and Maven plugins to the 3.5.x release line.

  • Rename Spring Boot configuration properties to match the new property names.

  • Upgrade Spring Framework to 6.2.

  • Upgrade related build plugins: the io.spring.dependency-management Gradle plugin to 1.1.x, the GraalVM Native Build Tools plugin to 0.10.x, and the CycloneDX SBOM plugin to 2.x.

  • Chain the Spring Cloud 2025.0 and Spring AI 1.1 upgrade recipes, since their managed versions move with Spring Boot.

  • Migrate the Mockito test-support APIs from Spring Boot to Spring Framework: replace @MockBean with @MockitoBean and @SpyBean with @MockitoSpyBean, relocate the MockReset type to org.springframework.test.context.bean.override.mockito, remove the dropped classes (and value for @SpyBean) annotation attributes, and rename the answer attribute on @MockBean to answers.

  • Apply type relocations introduced in 3.5, including moving RequestMatcherProvider to the Actuator security package and dropping the .servlet segment from OAuth2ClientAutoConfiguration.

Run the recipe

You can apply this recipe with any OpenRewrite-compatible tool. The tabs below show three of them: the Arconia CLI, the OpenRewrite Gradle plugin, and the OpenRewrite Maven plugin. See Running Recipes for a comparison of when to pick each one.

  • Arconia CLI

  • Gradle

  • Maven

arconia update spring-boot --to-version=3.5

First, create an init.gradle file in your project root with the following content.

initscript {
    repositories {
        maven { url "https://plugins.gradle.org/m2" }
    }
    dependencies {
        classpath("org.openrewrite:plugin:latest.release")
    }
}

rootProject {
    plugins.apply(org.openrewrite.gradle.RewritePlugin)
    dependencies {
        rewrite("io.arconia.migrations:rewrite-spring:latest.release")
    }

    afterEvaluate {
        if (repositories.isEmpty()) {
            repositories {
                mavenCentral()
            }
        }
    }

    configurations.named("rewrite") {
        canBeConsumed = false
    }
}

Then, run the following command.

./gradlew rewriteRun \
    --init-script init.gradle \
    -DactiveRecipe=io.arconia.rewrite.spring.boot.UpgradeSpringBoot_3_5

You can remove the init.gradle file afterwards.

./mvnw -U org.openrewrite.maven:rewrite-maven-plugin:run \
  -Drewrite.recipeArtifactCoordinates=io.arconia.migrations:rewrite-spring:LATEST \
  -Drewrite.activeRecipes=io.arconia.rewrite.spring.boot.UpgradeSpringBoot_3_5