Skip to content

Commit

Permalink
Spring Boot 3.3 migration recipes (#527)
Browse files Browse the repository at this point in the history
* Spring Boot 3.3 migration recipes

* Add a note that properties recipes are generated

* Expand best practices with spring http recipes
  • Loading branch information
timtebeek authored May 18, 2024
1 parent 8ca31b6 commit 634f2ad
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This file is automatically generated by the GeneratePropertiesMigratorConfiguration class.
# Do not edit this file manually. Update the Spring Boot property metadata upstream instead.
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.spring.boot3.SpringBootProperties_3_1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This file is automatically generated by the GeneratePropertiesMigratorConfiguration class.
# Do not edit this file manually. Update the Spring Boot property metadata upstream instead.
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.spring.boot3.SpringBootProperties_3_2
Expand Down
13 changes: 0 additions & 13 deletions src/main/resources/META-INF/rewrite/spring-boot-32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,3 @@ recipeList:
- org.openrewrite.java.spring.AddSpringProperty:
property: spring.threads.virtual.enabled
value: true

---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.spring.boot3.SpringBoot3BestPractices
displayName: Spring Boot 3.x best practices
description: Applies best practices to Spring Boot 3 applications.
tags:
- spring
- boot
recipeList:
- org.openrewrite.java.spring.boot2.SpringBoot2BestPractices
- org.openrewrite.java.migrate.UpgradeToJava21 # Allows for virtual threads
- org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_2
33 changes: 33 additions & 0 deletions src/main/resources/META-INF/rewrite/spring-boot-33-properties.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#
# Copyright 2024 the original author or authors.
# <p>
# 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
# <p>
# https://www.apache.org/licenses/LICENSE-2.0
# <p>
# 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.
#
# This file is automatically generated by the GeneratePropertiesMigratorConfiguration class.
# Do not edit this file manually. Update the Spring Boot property metadata upstream instead.
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.spring.boot3.SpringBootProperties_3_3
displayName: Migrate Spring Boot properties to 3.3
description: Migrate properties found in `application.properties` and `application.yml`.
tags:
- spring
- boot
recipeList:
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: spring.couchbase.env.ssl.key-store
newPropertyKey: spring.couchbase.env.ssl.bundle
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: spring.couchbase.env.ssl.key-store-password
newPropertyKey: spring.couchbase.env.ssl.bundle

72 changes: 72 additions & 0 deletions src/main/resources/META-INF/rewrite/spring-boot-33.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#
# Copyright 2024 the original author or authors.
# <p>
# 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
# <p>
# https://www.apache.org/licenses/LICENSE-2.0
# <p>
# 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_3
displayName: Migrate to Spring Boot 3.3
description: >
Migrate applications to the latest Spring Boot 3.3 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.2.
tags:
- spring
- boot
recipeList:
- org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_2
- org.openrewrite.java.spring.boot3.SpringBootProperties_3_3
- org.openrewrite.java.dependencies.UpgradeDependencyVersion:
groupId: org.springframework.boot
artifactId: "*"
newVersion: 3.3.x
overrideManagedVersion: false
- org.openrewrite.java.dependencies.UpgradeDependencyVersion:
groupId: org.springframework
artifactId: "*"
newVersion: 6.1.x
- org.openrewrite.maven.UpgradeParentVersion:
groupId: org.springframework.boot
artifactId: spring-boot-starter-parent
newVersion: 3.3.x
- org.openrewrite.gradle.plugins.UpgradePluginVersion:
pluginIdPattern: org.springframework.boot
newVersion: 3.3.x

- org.openrewrite.gradle.plugins.UpgradePluginVersion:
pluginIdPattern: org.graalvm.buildtools.native
newVersion: 0.10.x

- org.openrewrite.java.dependencies.ChangeDependency:
oldGroupId: com.datastax.oss
newGroupId: org.apache.cassandra
oldArtifactId: "*"

---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.spring.boot3.SpringBoot3BestPractices
displayName: Spring Boot 3.x best practices
description: Applies best practices to Spring Boot 3 applications.
tags:
- spring
- boot
recipeList:
- org.openrewrite.java.spring.boot2.SpringBoot2BestPractices
- org.openrewrite.java.migrate.UpgradeToJava21 # Allows for virtual threads
- org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_3
# Replace literals with constants and simplify MediaType parse calls
- org.openrewrite.java.spring.http.ReplaceStringLiteralsWithHttpHeadersConstants
- org.openrewrite.java.spring.http.ReplaceStringLiteralsWithMediaTypeConstants
- org.openrewrite.java.spring.http.SimplifyMediaTypeParseCalls
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ public static void main(String[] args) throws IOException {
.collect(Collectors.joining("\n")) + "\n#\n");

Files.writeString(config, """
# This file is automatically generated by the GeneratePropertiesMigratorConfiguration class.
# Do not edit this file manually. Update the Spring Boot property metadata upstream instead.
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.spring.boot%1$s.SpringBootProperties_%1$s_%2$s
Expand Down

0 comments on commit 634f2ad

Please sign in to comment.