From a8c3131409a58901d6d40a8fca0b631d9c677f90 Mon Sep 17 00:00:00 2001 From: Simon Verhoeven Date: Fri, 17 Nov 2023 20:03:38 +0100 Subject: [PATCH 1/4] feat: add recipe for Spring Boot Java 21 related recipes --- .../resources/META-INF/rewrite/spring-boot-32.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/resources/META-INF/rewrite/spring-boot-32.yml b/src/main/resources/META-INF/rewrite/spring-boot-32.yml index 9912f4e9a..38fe79034 100644 --- a/src/main/resources/META-INF/rewrite/spring-boot-32.yml +++ b/src/main/resources/META-INF/rewrite/spring-boot-32.yml @@ -32,3 +32,16 @@ recipeList: oldPropertyKey: spring.liquibase.labels newPropertyKey: spring.liquibase.label-filter + +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.openrewrite.java.spring.boot3.SpringBootProperties_3_2_Java21 +displayName: Migrate Spring Boot properties to 3.2 for Java 21 +description: Migrate properties found in `application.properties` and `application.yml`. +preconditions: + - org.openrewrite.java.search.HasJavaVersion: + version: 21.X +recipeList: + - org.openrewrite.java.spring.AddSpringProperty: + property: spring.threads.virtual.enabled + value: true From 2b7f09fadb4b4f29da18697f19b52b9d9767f1ed Mon Sep 17 00:00:00 2001 From: Simon Verhoeven Date: Mon, 20 Nov 2023 15:56:04 +0100 Subject: [PATCH 2/4] feat: restore spring boot 3.2 recipe, add Spring Boot 3.2 recipe --- .../META-INF/rewrite/spring-boot-32.yml | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/main/resources/META-INF/rewrite/spring-boot-32.yml diff --git a/src/main/resources/META-INF/rewrite/spring-boot-32.yml b/src/main/resources/META-INF/rewrite/spring-boot-32.yml new file mode 100644 index 000000000..ee1015735 --- /dev/null +++ b/src/main/resources/META-INF/rewrite/spring-boot-32.yml @@ -0,0 +1,57 @@ +# +# Copyright 2023 the original author or authors. +#

+# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +#

+# https://www.apache.org/licenses/LICENSE-2.0 +#

+# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_2 +displayName: Migrate to Spring Boot 3.2 +description: > + Migrate applications to the latest Spring Boot 3.2 release. This recipe will modify an + application's build files, make changes to deprecated/preferred APIs, and migrate configuration settings that have + changes between versions. This recipe will also chain additional framework migrations (Spring Framework, Spring Data, + etc) that are required as part of the migration to Spring Boot 3.1. +tags: + - spring + - boot +recipeList: + - org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_1 + - org.openrewrite.java.dependencies.UpgradeDependencyVersion: + groupId: org.springframework.boot + artifactId: "*" + newVersion: 3.2.x + overrideManagedVersion: false + - org.openrewrite.maven.UpgradeParentVersion: + groupId: org.springframework.boot + artifactId: spring-boot-starter-parent + newVersion: 3.2.x + - org.openrewrite.gradle.plugins.UpgradePluginVersion: + pluginIdPattern: org.springframework.boot + newVersion: 3.2.x + - org.openrewrite.java.spring.security6.UpgradeSpringSecurity_6_2 + - org.openrewrite.java.spring.boot3.SpringBootProperties_3_2 + - org.openrewrite.java.spring.boot3.SpringBootProperties_3_2_Java21 + +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.openrewrite.java.spring.boot3.SpringBootProperties_3_2_Java21 +displayName: Migrate Spring Boot properties to 3.2 for Java 21 +description: Migrate properties found in `application.properties` and `application.yml`. +preconditions: + - org.openrewrite.java.search.HasJavaVersion: + version: 21.X +recipeList: + - org.openrewrite.java.spring.AddSpringProperty: + property: spring.threads.virtual.enabled + value: true From ec3bd98a4366f44c1ec0b32e1861b41e660aeeef Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Mon, 20 Nov 2023 16:34:48 +0100 Subject: [PATCH 3/4] Revert spring-boot-31-properties.yml changes --- .../META-INF/rewrite/spring-boot-31-properties.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/main/resources/META-INF/rewrite/spring-boot-31-properties.yml b/src/main/resources/META-INF/rewrite/spring-boot-31-properties.yml index e3367a48f..80fbbe873 100644 --- a/src/main/resources/META-INF/rewrite/spring-boot-31-properties.yml +++ b/src/main/resources/META-INF/rewrite/spring-boot-31-properties.yml @@ -32,16 +32,3 @@ recipeList: oldPropertyKey: spring.kafka.streams.cache-max-size-buffering newPropertyKey: spring.kafka.streams.state-store-cache-max-size - ---- -type: specs.openrewrite.org/v1beta/recipe -name: org.openrewrite.java.spring.boot3.SpringBootProperties_3_2_Java21 -displayName: Migrate Spring Boot properties to 3.2 for Java 21 -description: Migrate properties found in `application.properties` and `application.yml`. -preconditions: - - org.openrewrite.java.search.HasJavaVersion: - version: 21.X -recipeList: - - org.openrewrite.java.spring.AddSpringProperty: - property: spring.threads.virtual.enabled - value: true From 95ba4ecdda5ced0bf0f5e0e2e14b2a290c98b2fe Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Mon, 20 Nov 2023 16:45:16 +0100 Subject: [PATCH 4/4] Rename SpringBootProperties_3_2_Java21 --- src/main/resources/META-INF/rewrite/spring-boot-31.yml | 6 +++++- src/main/resources/META-INF/rewrite/spring-boot-32.yml | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/resources/META-INF/rewrite/spring-boot-31.yml b/src/main/resources/META-INF/rewrite/spring-boot-31.yml index 7802192d9..6461ceb81 100644 --- a/src/main/resources/META-INF/rewrite/spring-boot-31.yml +++ b/src/main/resources/META-INF/rewrite/spring-boot-31.yml @@ -18,7 +18,11 @@ type: specs.openrewrite.org/v1beta/recipe name: org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_1 displayName: Migrate to Spring Boot 3.1 -description: 'Upgrade to Spring Boot 3.1' +description: > + Migrate applications to the latest Spring Boot 3.1 release. This recipe will modify an + application's build files, make changes to deprecated/preferred APIs, and migrate configuration settings that have + changes between versions. This recipe will also chain additional framework migrations (Spring Framework, Spring Data, + etc) that are required as part of the migration to Spring Boot 3.0. tags: - spring - boot diff --git a/src/main/resources/META-INF/rewrite/spring-boot-32.yml b/src/main/resources/META-INF/rewrite/spring-boot-32.yml index ee1015735..0e17d2268 100644 --- a/src/main/resources/META-INF/rewrite/spring-boot-32.yml +++ b/src/main/resources/META-INF/rewrite/spring-boot-32.yml @@ -41,13 +41,13 @@ recipeList: newVersion: 3.2.x - org.openrewrite.java.spring.security6.UpgradeSpringSecurity_6_2 - org.openrewrite.java.spring.boot3.SpringBootProperties_3_2 - - org.openrewrite.java.spring.boot3.SpringBootProperties_3_2_Java21 + - org.openrewrite.java.spring.boot3.EnableVirtualThreads --- type: specs.openrewrite.org/v1beta/recipe -name: org.openrewrite.java.spring.boot3.SpringBootProperties_3_2_Java21 -displayName: Migrate Spring Boot properties to 3.2 for Java 21 -description: Migrate properties found in `application.properties` and `application.yml`. +name: org.openrewrite.java.spring.boot3.EnableVirtualThreads +displayName: Enable Virtual Threads on Java 21 +description: Set `spring.threads.virtual.enabled` to `true` in `application.properties` or `application.yml`. preconditions: - org.openrewrite.java.search.HasJavaVersion: version: 21.X