Migrate to Spring for GraphQL 2.0
Recipe ID
io.moderne.java.spring.boot4.UpgradeSpringGraphQl_2_0Artifactio.moderne.recipe:rewrite-springMigrate applications to Spring for GraphQL 2.0. This upgrades explicitly versioned Spring for GraphQL, GraphQL Java, Java DataLoader and Apollo Federation dependencies to the versions Spring for GraphQL 2.0 requires, and rewrites APIs deprecated for removal to their replacements.
Composite recipespringgraphqlProprietary
Add to your build
Get a download tokenThis recipe is Moderne licensed, so the token must belong to a Moderne customer. It replaces YOUR_DOWNLOAD_TOKEN below.
~/.gradle/gradle.properties
codeGenomeUsername=you@example.com
codeGenomeToken=YOUR_DOWNLOAD_TOKEN
build.gradle.kts
plugins {
id("org.openrewrite.rewrite") version("latest.release")
}
rewrite {
activeRecipe("io.moderne.java.spring.boot4.UpgradeSpringGraphQl_2_0")
}
repositories {
mavenCentral()
maven {
url = uri("https://artifacts.codegenomeproject.org/maven")
credentials {
username = providers.gradleProperty("codeGenomeUsername").get()
password = providers.gradleProperty("codeGenomeToken").get()
}
}
}
dependencies {
rewrite("io.moderne.recipe:rewrite-spring:0.44.0")
}
Then run
./gradlew rewriteRunUsage
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.UpgradeSpringGraphQl_2_0If the recipe isn’t available locally, install it with:
mod config recipes jar install io.moderne.recipe:rewrite-spring:RELEASEDefinition
This recipe runs the following recipes in order.
- Upgrade Gradle or Maven dependency versions
org.openrewrite.java.dependencies.UpgradeDependencyVersion - Upgrade Gradle or Maven dependency versions
org.openrewrite.java.dependencies.UpgradeDependencyVersion - Upgrade Gradle or Maven dependency versions
org.openrewrite.java.dependencies.UpgradeDependencyVersion - Upgrade Gradle or Maven dependency versions
org.openrewrite.java.dependencies.UpgradeDependencyVersion - Change type
ContextSnapshotFactoryHelpertoContextPropagationHelperorg.openrewrite.java.ChangeType - Add a
nullmethod argument 3 in methodsorg.springframework.graphql.server.WebGraphQlRequest <constructor>(java.net.URI, org.springframework.http.HttpHeaders, org.springframework.util.MultiValueMap, java.util.Map, org.springframework.graphql.GraphQlRequest, java.lang.String, java.util.Locale)org.openrewrite.java.AddNullMethodArgument - Add a
nullmethod argument 3 in methodsorg.springframework.graphql.server.WebGraphQlRequest <constructor>(java.net.URI, org.springframework.http.HttpHeaders, org.springframework.util.MultiValueMap, java.util.Map, java.util.Map, java.lang.String, java.util.Locale)org.openrewrite.java.AddNullMethodArgument - Add a
nullmethod argument 3 in methodsorg.springframework.graphql.server.WebSocketGraphQlRequest <constructor>(java.net.URI, org.springframework.http.HttpHeaders, org.springframework.util.MultiValueMap, java.util.Map, java.util.Map, java.lang.String, java.util.Locale, org.springframework.graphql.server.WebSocketSessionInfo)org.openrewrite.java.AddNullMethodArgument - Add a
nullmethod argument 3 in methodsorg.springframework.graphql.observation.GraphQlObservationInstrumentation <constructor>(io.micrometer.observation.ObservationRegistry, org.springframework.graphql.observation.ExecutionRequestObservationConvention, org.springframework.graphql.observation.DataFetcherObservationConvention)org.openrewrite.java.AddNullMethodArgument - Migrate
defaultScrollSubrange(ScrollSubrange)todefaultScrollSubrange(int, Function)io.moderne.java.spring.graphql.MigrateDefaultScrollSubrange - Migrate
GraphQlArgumentBinderconstructors toGraphQlArgumentBinder.Optionsio.moderne.java.spring.graphql.MigrateGraphQlArgumentBinderConstructor - Migrate
setFallBackOnDirectFieldAccesstoconfigureBinderio.moderne.java.spring.graphql.MigrateSetFallBackOnDirectFieldAccess
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