-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy pathspring-boot-24.yml
175 lines (169 loc) · 8.51 KB
/
spring-boot-24.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#
# Copyright 2023 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.
#
########################################################################################################################
# SpringBoot 2.4
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.spring.boot2.UpgradeSpringBoot_2_4
displayName: Migrate to Spring Boot 2.4
description: >
Migrate applications to the latest Spring Boot 2.4 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 2.4.
tags:
- spring
- boot
recipeList:
- org.openrewrite.java.spring.boot2.UpgradeSpringBoot_2_3
- org.openrewrite.java.spring.framework.UpgradeSpringFramework_5_3
- org.openrewrite.java.spring.boot2.SpringBoot2JUnit4to5Migration
- org.openrewrite.java.dependencies.UpgradeDependencyVersion:
groupId: org.springframework.boot
artifactId: "*"
newVersion: 2.4.x
overrideManagedVersion: false
- org.openrewrite.maven.UpgradeParentVersion:
groupId: org.springframework.boot
artifactId: spring-boot-starter-parent
newVersion: 2.4.x
- org.openrewrite.maven.RemoveExclusion:
groupId: org.springframework.boot
artifactId: spring-boot-starter-test
exclusionGroupId: org.junit.vintage
exclusionArtifactId: junit-vintage-engine
- org.openrewrite.maven.RemoveExclusion:
groupId: org.springframework.boot
artifactId: spring-boot-starter-test
exclusionGroupId: junit
exclusionArtifactId: junit
# Use recommended replacements for deprecated APIs
- org.openrewrite.java.spring.boot2.MigrateUndertowServletWebServerFactoryIsEagerInitFilters
- org.openrewrite.java.spring.boot2.MigrateUndertowServletWebServerFactorySetEagerInitFilters
- org.openrewrite.java.spring.boot2.MigrateLoggingSystemPropertyConstants
- org.openrewrite.java.spring.boot2.MigrateHsqlEmbeddedDatabaseConnection
# Update properties
- org.openrewrite.java.spring.boot2.SpringBootProperties_2_4
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.spring.boot2.MigrateUndertowServletWebServerFactoryIsEagerInitFilters
displayName: Use `isEagerFilterInit()`
description: '`org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory#isEagerInitFilters` was deprecated in 2.4 and are removed in 2.6.'
recipeList:
- org.openrewrite.java.ChangeMethodName:
methodPattern: org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory isEagerInitFilters()
newMethodName: isEagerFilterInit
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.spring.boot2.MigrateUndertowServletWebServerFactorySetEagerInitFilters
displayName: Use `setEagerFilterInit(boolean)`
description: '`org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory#setEagerInitFilters` was deprecated in 2.4 and are removed in 2.6.'
recipeList:
- org.openrewrite.java.ChangeMethodName:
methodPattern: org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory setEagerInitFilters(boolean)
newMethodName: setEagerFilterInit
---
########################################################################################################################
# SpringBoot 2.4 Configuration Changes
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.spring.boot2.SpringBootProperties_2_4
displayName: Migrate Spring Boot properties to 2.4
description: Migrate properties found in `application.properties` and `application.yml`.
recipeList:
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: logging.pattern.rolling-file-name
newPropertyKey: logging.logback.rollingpolicy.file-name-pattern
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: logging.file.clean-history-on-start
newPropertyKey: logging.logback.rollingpolicy.clean-history-on-start
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: logging.file.max-size
newPropertyKey: logging.logback.rollingpolicy.max-file-size
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: logging.file.total-size-cap
newPropertyKey: logging.logback.rollingpolicy.total-size-cap
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: logging.file.max-history
newPropertyKey: logging.logback.rollingpolicy.max-history
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: spring.profiles
newPropertyKey: spring.config.activate.on-profile
except: [ active, default, group, include ]
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: spring.data.neo4j.password
newPropertyKey: spring.neo4j.authentication.password
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: spring.data.neo4j.repositories.enabled
newPropertyKey: spring.data.neo4j.repositories.type
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: spring.data.neo4j.uri
newPropertyKey: spring.neo4j.uri
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: spring.data.neo4j.username
newPropertyKey: spring.neo4j.authentication.password
---
########################################################################################################################
# SpringBoot 2.x JUnit 4 to Junit 5 Migration
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.spring.boot2.SpringBoot2JUnit4to5Migration
displayName: Migrate Spring Boot 2.x projects to JUnit 5 from JUnit 4.
description: >
This recipe will migrate a Spring Boot application's tests from JUnit 4 to JUnit 5. This spring-specific migration
includes conversion of Spring Test runners to Spring Test extensions and awareness of the composable Spring Test
annotations.
tags:
- test
- junit
- jupiter
- spring
- boot
recipeList:
- org.openrewrite.java.testing.junit5.JUnit4to5Migration
- org.openrewrite.java.spring.boot2.OutputCaptureExtension
- org.openrewrite.java.spring.boot2.UnnecessarySpringRunWith
- org.openrewrite.java.spring.boot2.UnnecessarySpringExtension
- org.openrewrite.java.spring.boot2.ReplaceExtendWithAndContextConfiguration
- org.openrewrite.java.spring.boot2.RemoveObsoleteSpringRunners
- org.openrewrite.java.dependencies.AddDependency:
groupId: org.springframework.boot
artifactId: spring-boot-tools
version: 2.x
onlyIfUsing: org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathExtension
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.spring.boot2.UnnecessarySpringRunWith
displayName: Remove unnecessary Spring `@RunWith`
description: Remove `@RunWith` annotations on Spring tests.
recipeList:
- org.openrewrite.java.testing.junit5.RunnerToExtension:
runners:
- org.springframework.test.context.junit4.SpringRunner
- org.springframework.test.context.junit4.SpringJUnit4ClassRunner
extension: org.springframework.test.context.junit.jupiter.SpringExtension
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.spring.boot2.RemoveObsoleteSpringRunners
displayName: Remove obsolete Spring JUnit runners
description: Remove obsolete classpath runners.
recipeList:
- org.openrewrite.java.testing.junit5.RemoveObsoleteRunners:
obsoleteRunners:
- org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner
- org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner
# There is a third variant of this class in spring-cloud-commons and there is not yet a suitable migration
# path. Once one exists, this can likely be added for removal as well.
#- org.springframework.cloud.test.ModifiedClassPathRunner
- org.openrewrite.java.testing.junit5.JUnit5BestPractices