Migrate Spring Boot properties to 2.2
org.openrewrite.java.spring.boot2.SpringBootProperties_2_2
Migrate properties found in application.properties
and application.yml
.
Tags
- spring
- boot
Recipe source
GitHub, Issue Tracker, Maven Central
This recipe is composed of more than one recipe. If you want to customize the set of recipes this is composed of, you can find and copy the GitHub source for the recipe from the link above.
Definition
- Recipe List
- Yaml Recipe List
- Change the key of a spring application property
- oldPropertyKey:
management.health.status.http-mapping
- newPropertyKey:
management.endpoint.health.status.http-mapping
- oldPropertyKey:
- Change the key of a spring application property
- oldPropertyKey:
management.health.status.order
- newPropertyKey:
management.endpoint.health.status.order
- oldPropertyKey:
- Change the key of a spring application property
- oldPropertyKey:
management.metrics.web.client.requests-metric-name
- newPropertyKey:
management.metrics.web.client.request.metric-name
- oldPropertyKey:
- Change the key of a spring application property
- oldPropertyKey:
management.metrics.web.server.auto-time-requests
- newPropertyKey:
management.metrics.web.server.request.autotime.enabled
- oldPropertyKey:
- Change the key of a spring application property
- oldPropertyKey:
management.metrics.web.server.requests-metric-name
- newPropertyKey:
management.metrics.web.server.request.metric-name
- oldPropertyKey:
- Change the key of a spring application property
- oldPropertyKey:
server.jetty.accesslog.date-format
- newPropertyKey:
server.jetty.accesslog.custom-format
- oldPropertyKey:
- Change the key of a spring application property
- oldPropertyKey:
server.jetty.accesslog.extended-format
- newPropertyKey:
server.jetty.accesslog.format
- oldPropertyKey:
- Change the key of a spring application property
- oldPropertyKey:
server.jetty.accesslog.locale
- newPropertyKey:
server.jetty.accesslog.custom-format
- oldPropertyKey:
- Change the key of a spring application property
- oldPropertyKey:
server.jetty.accesslog.log-cookies
- newPropertyKey:
server.jetty.accesslog.custom-format
- oldPropertyKey:
- Change the key of a spring application property
- oldPropertyKey:
server.jetty.accesslog.log-latency
- newPropertyKey:
server.jetty.accesslog.custom-format
- oldPropertyKey:
- Change the key of a spring application property
- oldPropertyKey:
server.jetty.accesslog.log-server
- newPropertyKey:
server.jetty.accesslog.custom-format
- oldPropertyKey:
- Change the key of a spring application property
- oldPropertyKey:
server.jetty.accesslog.time-zone
- newPropertyKey:
server.jetty.accesslog.custom-format
- oldPropertyKey:
- Change the key of a spring application property
- oldPropertyKey:
server.use-forward-headers
- newPropertyKey:
server.forward-headers-strategy
- oldPropertyKey:
- Change the key of a spring application property
- oldPropertyKey:
spring.datasource.jmx-enabled
- newPropertyKey:
spring.datasource.tomcat.jmx-enabled
- oldPropertyKey:
- Change the key of a spring application property
- oldPropertyKey:
spring.jackson.joda-date-time-format
- newPropertyKey:
dateFormat
- oldPropertyKey:
- Change the key of a spring application property
- oldPropertyKey:
spring.rabbitmq.listener.simple.transaction-size
- newPropertyKey:
spring.rabbitmq.listener.simple.batch-size
- oldPropertyKey:
- Change the key of a spring application property
- oldPropertyKey:
spring.rabbitmq.publisher-confirms
- newPropertyKey:
spring.rabbitmq.publisher-confirm-type
- oldPropertyKey:
- Change the key of a spring application property
- oldPropertyKey:
spring.reactor.stacktrace-mode.enabled
- newPropertyKey:
spring.reactor.debug-agent.enabled
- oldPropertyKey:
- Change the key of a spring application property
- oldPropertyKey:
logging.file
- newPropertyKey:
logging.file.name
- except:
[.+]
- oldPropertyKey:
- Change the key of a spring application property
- oldPropertyKey:
logging.path
- newPropertyKey:
logging.file.path
- oldPropertyKey:
- Comment out Spring properties
- propertyKey:
management.health.elasticsearch.indices
- comment:
This property is deprecated: Upstream elasticsearch transport is deprecated.
- propertyKey:
- Comment out Spring properties
- propertyKey:
management.health.elasticsearch.response-timeout
- comment:
This property is deprecated: Upstream elasticsearch transport is deprecated.
- propertyKey:
- Comment out Spring properties
- propertyKey:
management.metrics.export.appoptics.num-threads
- comment:
This property is deprecated and will be removed in future Spring Boot versions
- propertyKey:
- Comment out Spring properties
- propertyKey:
management.metrics.export.datadog.num-threads
- comment:
This property is deprecated and will be removed in future Spring Boot versions
- propertyKey:
- Comment out Spring properties
- propertyKey:
management.metrics.export.dynatrace.num-threads
- comment:
This property is deprecated and will be removed in future Spring Boot versions
- propertyKey:
- Comment out Spring properties
- propertyKey:
management.metrics.export.elastic.num-threads
- comment:
This property is deprecated and will be removed in future Spring Boot versions
- propertyKey:
- Comment out Spring properties
- propertyKey:
management.metrics.export.humio.num-threads
- comment:
This property is deprecated and will be removed in future Spring Boot versions
- propertyKey:
- Comment out Spring properties
- propertyKey:
management.metrics.export.humio.repository
- comment:
This property is deprecated: No longer used as repository is resolved from the api token.
- propertyKey:
- Comment out Spring properties
- propertyKey:
management.metrics.export.influx.num-threads
- comment:
This property is deprecated and will be removed in future Spring Boot versions
- propertyKey:
- Comment out Spring properties
- propertyKey:
management.metrics.export.kairos.num-threads
- comment:
This property is deprecated and will be removed in future Spring Boot versions
- propertyKey:
- Comment out Spring properties
- propertyKey:
management.metrics.export.newrelic.num-threads
- comment:
This property is deprecated and will be removed in future Spring Boot versions
- propertyKey:
- Comment out Spring properties
- propertyKey:
management.metrics.export.signalfx.num-threads
- comment:
This property is deprecated and will be removed in future Spring Boot versions
- propertyKey:
- Comment out Spring properties
- propertyKey:
management.metrics.export.wavefront.num-threads
- comment:
This property is deprecated and will be removed in future Spring Boot versions
- propertyKey:
- Comment out Spring properties
- propertyKey:
spring.data.elasticsearch.cluster-name
- comment:
This property is deprecated: The transport client support is deprecated. Use other supported clients instead.
- propertyKey:
- Comment out Spring properties
- propertyKey:
spring.data.elasticsearch.cluster-nodes
- comment:
This property is deprecated: The transport client support is deprecated. Use other supported clients instead.
- propertyKey:
- Comment out Spring properties
- propertyKey:
spring.data.elasticsearch.properties
- comment:
This property is deprecated: The transport client support is deprecated. Use other supported clients instead.
- propertyKey:
- Comment out Spring properties
- propertyKey:
spring.datasource.dbcp2.enable-auto-commit-on-return
- comment:
This property is deprecated and will be removed in future Spring Boot versions
- propertyKey:
- Comment out Spring properties
- propertyKey:
spring.elasticsearch.jest.uris
- comment:
This property is deprecated: The Jest client support is deprecated. Use other supported clients instead.
- propertyKey:
- Comment out Spring properties
- propertyKey:
spring.mvc.contentnegotiation.favor-path-extension
- comment:
This property is deprecated: Use of path extensions for request mapping and for content negotiation is discouraged.
- propertyKey:
- Comment out Spring properties
- propertyKey:
spring.mvc.favicon.enabled
- comment:
This property is deprecated and will be removed in future Spring Boot versions
- propertyKey:
- Comment out Spring properties
- propertyKey:
spring.mvc.pathmatch.use-registered-suffix-pattern
- comment:
This property is deprecated: Use of path extensions for request mapping and for content negotiation is discouraged.
- propertyKey:
- Comment out Spring properties
- propertyKey:
spring.mvc.pathmatch.use-suffix-pattern
- comment:
This property is deprecated: Use of path extensions for request mapping and for content negotiation is discouraged.
- propertyKey:
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.spring.boot2.SpringBootProperties_2_2
displayName: Migrate Spring Boot properties to 2.2
description: Migrate properties found in `application.properties` and `application.yml`.
tags:
- spring
- boot
recipeList:
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: management.health.status.http-mapping
newPropertyKey: management.endpoint.health.status.http-mapping
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: management.health.status.order
newPropertyKey: management.endpoint.health.status.order
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: management.metrics.web.client.requests-metric-name
newPropertyKey: management.metrics.web.client.request.metric-name
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: management.metrics.web.server.auto-time-requests
newPropertyKey: management.metrics.web.server.request.autotime.enabled
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: management.metrics.web.server.requests-metric-name
newPropertyKey: management.metrics.web.server.request.metric-name
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: server.jetty.accesslog.date-format
newPropertyKey: server.jetty.accesslog.custom-format
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: server.jetty.accesslog.extended-format
newPropertyKey: server.jetty.accesslog.format
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: server.jetty.accesslog.locale
newPropertyKey: server.jetty.accesslog.custom-format
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: server.jetty.accesslog.log-cookies
newPropertyKey: server.jetty.accesslog.custom-format
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: server.jetty.accesslog.log-latency
newPropertyKey: server.jetty.accesslog.custom-format
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: server.jetty.accesslog.log-server
newPropertyKey: server.jetty.accesslog.custom-format
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: server.jetty.accesslog.time-zone
newPropertyKey: server.jetty.accesslog.custom-format
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: server.use-forward-headers
newPropertyKey: server.forward-headers-strategy
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: spring.datasource.jmx-enabled
newPropertyKey: spring.datasource.tomcat.jmx-enabled
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: spring.jackson.joda-date-time-format
newPropertyKey: dateFormat
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: spring.rabbitmq.listener.simple.transaction-size
newPropertyKey: spring.rabbitmq.listener.simple.batch-size
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: spring.rabbitmq.publisher-confirms
newPropertyKey: spring.rabbitmq.publisher-confirm-type
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: spring.reactor.stacktrace-mode.enabled
newPropertyKey: spring.reactor.debug-agent.enabled
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: logging.file
newPropertyKey: logging.file.name
except: [.+]
- org.openrewrite.java.spring.ChangeSpringPropertyKey:
oldPropertyKey: logging.path
newPropertyKey: logging.file.path
- org.openrewrite.java.spring.CommentOutSpringPropertyKey:
propertyKey: management.health.elasticsearch.indices
comment: This property is deprecated: Upstream elasticsearch transport is deprecated.
- org.openrewrite.java.spring.CommentOutSpringPropertyKey:
propertyKey: management.health.elasticsearch.response-timeout
comment: This property is deprecated: Upstream elasticsearch transport is deprecated.
- org.openrewrite.java.spring.CommentOutSpringPropertyKey:
propertyKey: management.metrics.export.appoptics.num-threads
comment: This property is deprecated and will be removed in future Spring Boot versions
- org.openrewrite.java.spring.CommentOutSpringPropertyKey:
propertyKey: management.metrics.export.datadog.num-threads
comment: This property is deprecated and will be removed in future Spring Boot versions
- org.openrewrite.java.spring.CommentOutSpringPropertyKey:
propertyKey: management.metrics.export.dynatrace.num-threads
comment: This property is deprecated and will be removed in future Spring Boot versions
- org.openrewrite.java.spring.CommentOutSpringPropertyKey:
propertyKey: management.metrics.export.elastic.num-threads
comment: This property is deprecated and will be removed in future Spring Boot versions
- org.openrewrite.java.spring.CommentOutSpringPropertyKey:
propertyKey: management.metrics.export.humio.num-threads
comment: This property is deprecated and will be removed in future Spring Boot versions
- org.openrewrite.java.spring.CommentOutSpringPropertyKey:
propertyKey: management.metrics.export.humio.repository
comment: This property is deprecated: No longer used as repository is resolved from the api token.
- org.openrewrite.java.spring.CommentOutSpringPropertyKey:
propertyKey: management.metrics.export.influx.num-threads
comment: This property is deprecated and will be removed in future Spring Boot versions
- org.openrewrite.java.spring.CommentOutSpringPropertyKey:
propertyKey: management.metrics.export.kairos.num-threads
comment: This property is deprecated and will be removed in future Spring Boot versions
- org.openrewrite.java.spring.CommentOutSpringPropertyKey:
propertyKey: management.metrics.export.newrelic.num-threads
comment: This property is deprecated and will be removed in future Spring Boot versions
- org.openrewrite.java.spring.CommentOutSpringPropertyKey:
propertyKey: management.metrics.export.signalfx.num-threads
comment: This property is deprecated and will be removed in future Spring Boot versions
- org.openrewrite.java.spring.CommentOutSpringPropertyKey:
propertyKey: management.metrics.export.wavefront.num-threads
comment: This property is deprecated and will be removed in future Spring Boot versions
- org.openrewrite.java.spring.CommentOutSpringPropertyKey:
propertyKey: spring.data.elasticsearch.cluster-name
comment: This property is deprecated: The transport client support is deprecated. Use other supported clients instead.
- org.openrewrite.java.spring.CommentOutSpringPropertyKey:
propertyKey: spring.data.elasticsearch.cluster-nodes
comment: This property is deprecated: The transport client support is deprecated. Use other supported clients instead.
- org.openrewrite.java.spring.CommentOutSpringPropertyKey:
propertyKey: spring.data.elasticsearch.properties
comment: This property is deprecated: The transport client support is deprecated. Use other supported clients instead.
- org.openrewrite.java.spring.CommentOutSpringPropertyKey:
propertyKey: spring.datasource.dbcp2.enable-auto-commit-on-return
comment: This property is deprecated and will be removed in future Spring Boot versions
- org.openrewrite.java.spring.CommentOutSpringPropertyKey:
propertyKey: spring.elasticsearch.jest.uris
comment: This property is deprecated: The Jest client support is deprecated. Use other supported clients instead.
- org.openrewrite.java.spring.CommentOutSpringPropertyKey:
propertyKey: spring.mvc.contentnegotiation.favor-path-extension
comment: This property is deprecated: Use of path extensions for request mapping and for content negotiation is discouraged.
- org.openrewrite.java.spring.CommentOutSpringPropertyKey:
propertyKey: spring.mvc.favicon.enabled
comment: This property is deprecated and will be removed in future Spring Boot versions
- org.openrewrite.java.spring.CommentOutSpringPropertyKey:
propertyKey: spring.mvc.pathmatch.use-registered-suffix-pattern
comment: This property is deprecated: Use of path extensions for request mapping and for content negotiation is discouraged.
- org.openrewrite.java.spring.CommentOutSpringPropertyKey:
propertyKey: spring.mvc.pathmatch.use-suffix-pattern
comment: This property is deprecated: Use of path extensions for request mapping and for content negotiation is discouraged.
Usage
This recipe has no required configuration options. It can be activated by adding a dependency on org.openrewrite.recipe:rewrite-spring
in your build file or by running a shell command (in which case no build changes are needed):
- Gradle
- Gradle init script
- Maven POM
- Maven Command Line
- Moderne CLI
- Add the following to your
build.gradle
file:
plugins {
id("org.openrewrite.rewrite") version("6.28.1")
}
rewrite {
activeRecipe("org.openrewrite.java.spring.boot2.SpringBootProperties_2_2")
setExportDatatables(true)
}
repositories {
mavenCentral()
}
dependencies {
rewrite("org.openrewrite.recipe:rewrite-spring:5.24.1")
}
- Run
gradle rewriteRun
to run the recipe.
- Create a file named
init.gradle
in the root of your project.
initscript {
repositories {
maven { url "https://plugins.gradle.org/m2" }
}
dependencies { classpath("org.openrewrite:plugin:6.28.1") }
}
rootProject {
plugins.apply(org.openrewrite.gradle.RewritePlugin)
dependencies {
rewrite("org.openrewrite.recipe:rewrite-spring:5.24.1")
}
rewrite {
activeRecipe("org.openrewrite.java.spring.boot2.SpringBootProperties_2_2")
setExportDatatables(true)
}
afterEvaluate {
if (repositories.isEmpty()) {
repositories {
mavenCentral()
}
}
}
}
- Run the recipe.
gradle --init-script init.gradle rewriteRun
- Add the following to your
pom.xml
file:
<project>
<build>
<plugins>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<version>5.46.1</version>
<configuration>
<exportDatatables>true</exportDatatables>
<activeRecipes>
<recipe>org.openrewrite.java.spring.boot2.SpringBootProperties_2_2</recipe>
</activeRecipes>
</configuration>
<dependencies>
<dependency>
<groupId>org.openrewrite.recipe</groupId>
<artifactId>rewrite-spring</artifactId>
<version>5.24.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
- Run
mvn rewrite:run
to run the recipe.
You will need to have Maven installed on your machine before you can run the following command.
mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-spring:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.spring.boot2.SpringBootProperties_2_2 -Drewrite.exportDatatables=true
You will need to have configured the Moderne CLI on your machine before you can run the following command.
mod run . --recipe SpringBootProperties_2_2
If the recipe is not available locally, then you can install it using:
mod config recipes jar install org.openrewrite.recipe:rewrite-spring:5.24.1
See how this recipe works across multiple open-source repositories
Run this recipe on OSS repos at scale with the Moderne SaaS.
The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories.
Please contact Moderne for more information about safely running the recipes on your own codebase in a private SaaS.
Data Tables
Source files that had results
org.openrewrite.table.SourcesFileResults
Source files that were modified by the recipe run.
Column Name | Description |
---|---|
Source path before the run | The source path of the file before the run. null when a source file was created during the run. |
Source path after the run | A recipe may modify the source path. This is the path after the run. null when a source file was deleted during the run. |
Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. |
Recipe that made changes | The specific recipe that made a change. |
Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. |
Cycle | The recipe cycle in which the change was made. |
Source files that errored on a recipe
org.openrewrite.table.SourcesFileErrors
The details of all errors produced by a recipe run.
Column Name | Description |
---|---|
Source path | The file that failed to parse. |
Recipe that made changes | The specific recipe that made a change. |
Stack trace | The stack trace of the failure. |
Recipe performance
org.openrewrite.table.RecipeRunStats
Statistics used in analyzing the performance of recipes.
Column Name | Description |
---|---|
The recipe | The recipe whose stats are being measured both individually and cumulatively. |
Source file count | The number of source files the recipe ran over. |
Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. |
Cumulative scanning time | The total time spent across the scanning phase of this recipe. |
99th percentile scanning time | 99 out of 100 scans completed in this amount of time. |
Max scanning time | The max time scanning any one source file. |
Cumulative edit time | The total time spent across the editing phase of this recipe. |
99th percentile edit time | 99 out of 100 edits completed in this amount of time. |
Max edit time | The max time editing any one source file. |
Contributors
ashakirin, Tyler Van Gorder, Knut Wannheden, Tim te Beek, Nick McKinney, Patrick, Jonathan Schnéider, Kyle Scully