Migrate from standalone Spring gRPC 1.0 to Spring Boot 4.1 (Spring gRPC 1.1)
io.moderne.java.spring.boot4.MigrateSpringGrpc_1_1io.moderne.recipe:rewrite-springMigrate applications from the standalone Spring gRPC project (org.springframework.grpc:*, Spring gRPC 1.0) to the version bundled with Spring Boot 4.1 (Spring gRPC 1.1). Spring gRPC graduated into Spring Boot in 4.1, so its starters, BOM, configuration properties, and test annotations move under org.springframework.boot.
Following the Spring gRPC 1.1 Migration Guide, this recipe swaps the org.springframework.grpc starters for the Spring Boot spring-boot-starter-grpc-* starters (splitting the combined runtime and test starters) and removes the standalone spring-grpc-dependencies BOM; renames the spring.grpc.server.* and per-channel spring.grpc.client.channels.<name>.* properties that changed in 1.1 and splits spring.grpc.server.address: host:port into separate address and port; renames the @AutoConfigureInProcessTransport and @LocalGrpcPort test annotations; and, because 1.1 no longer auto-scans generated proto stubs, flags classes that inject gRPC client stubs with a TODO so an explicit @ImportGrpcClients annotation can be added by hand.
Not automated: pinning the reactor-grpc-stub version. Spring gRPC 1.1 no longer manages it, so a version-less declaration must be given an explicit version once the standalone BOM is removed (Spring gRPC 1.0 managed 1.2.4).
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe io.moderne.java.spring.boot4.MigrateSpringGrpc_1_1If the recipe isn’t available locally, install it with:
mod config recipes jar install io.moderne.recipe:rewrite-spring:0.39.0Definition
This recipe runs the following recipes in order.
- Change Gradle or Maven dependency
org.openrewrite.java.dependencies.ChangeDependency - Change Gradle or Maven dependency
org.openrewrite.java.dependencies.ChangeDependency - Change Gradle or Maven dependency
org.openrewrite.java.dependencies.ChangeDependency - Split the combined Spring gRPC starter into server and client starters
io.moderne.java.spring.boot4.SplitSpringGrpcCombinedStarter - Split the Spring gRPC test starter into server-test and client-test starters
io.moderne.java.spring.boot4.SplitSpringGrpcCombinedTestStarter - Remove Maven managed dependency
org.openrewrite.maven.RemoveManagedDependency - Change the key of a Spring application property
org.openrewrite.java.spring.ChangeSpringPropertyKey - Change the key of a Spring application property
org.openrewrite.java.spring.ChangeSpringPropertyKey - Change property key
org.openrewrite.properties.ChangePropertyKey - Change property key
org.openrewrite.yaml.ChangePropertyKey - Change property key
org.openrewrite.properties.ChangePropertyKey - Change property key
org.openrewrite.yaml.ChangePropertyKey - Change the key of a Spring application property
org.openrewrite.java.spring.ChangeSpringPropertyKey - Change the key of a Spring application property
org.openrewrite.java.spring.ChangeSpringPropertyKey - Change the key of a Spring application property
org.openrewrite.java.spring.ChangeSpringPropertyKey - Change the key of a Spring application property
org.openrewrite.java.spring.ChangeSpringPropertyKey - Change the key of a Spring application property
org.openrewrite.java.spring.ChangeSpringPropertyKey - Change the key of a Spring application property
org.openrewrite.java.spring.ChangeSpringPropertyKey - Split
spring.grpc.server.addressintoaddressandportio.moderne.java.spring.boot4.SplitSpringGrpcServerAddress - Migrate Spring gRPC client channel properties to 1.1
io.moderne.java.spring.boot4.MigrateSpringGrpcClientChannelProperties - Change type
org.openrewrite.java.ChangeType - Change type
org.openrewrite.java.ChangeType - Flag gRPC client stub injections that need
@ImportGrpcClientsio.moderne.java.spring.boot4.FlagGrpcClientStubsForImportGrpcClients
Data tables
Structured output this recipe can produce.
- Source files that had resultsSource files that were modified by the recipe run.
org.openrewrite.table.SourcesFileResults - Source files that had search resultsSearch results that were found during the recipe run.
org.openrewrite.table.SearchResults - Source files that errored on a recipeThe details of all errors produced by a recipe run.
org.openrewrite.table.SourcesFileErrors - Recipe performanceStatistics used in analyzing the performance of recipes.
org.openrewrite.table.RecipeRunStats