Change the value of a Spring application property

MSAL

Change Spring application property values existing in either Properties or YAML files, and in @Value, @ConditionalOnProperty, @SpringBootTest, or @TestPropertySource annotations.

org.openrewrite.java.spring.ChangeSpringPropertyValue

Required

The name of the property key whose value is to be changed.

The new value to be used for key specified by propertyKey.

Optional

Only change the property value if it matches the configured oldValue.

regexBoolean

Default false. If enabled, oldValue will be interpreted as a Regular Expression, and capture group contents will be available in newValue

relaxedBindingBoolean

Whether to match the propertyKey using relaxed binding rules. Default is true. Set to false to use exact matching.

mod run . --recipe=org.openrewrite.java.spring.ChangeSpringPropertyValue \ -P propertyKey=management.metrics.binders.files.enabled \ -P newValue=management.metrics.enable.process.files

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.