Open fabapp2 opened 2 years ago
@fabapp2 I have created a new recipe, ChangeSpringPropertyKey
to encapsulate the renaming of a spring boot application property. This recipe will rename the key in .yml
, .yaml
, and .properties
files.
We can expand this recipe to add Java visitors that will make the renames within Java source code.
What needs to be done
When Spring application properties are changed or removed usages outside of
.properties
/.yaml
files need to be adjusted. For example, here the properties must be detected and changed.Other places are
@PropertySource
and there are other potential references (@Value
,...) that must be changed.Thoughts
It might be a good idea to enhance the
SpringBootApplicationProperties
resources for allproperties
related components so that it represents a composition of all configuration-related resources (@Value
,@PropertySource
,Profile
information, usages of a property withSystem.
andEnvironment
and other locations`). We then provide an API to e.g. change a property and adjust all locations.Given
Apply
Result
What needs to be done
The enhanced
SpringBootApplicationProperties
class should handle all "externalized configuration"@Value
@PropertySource
beansSystem.getProperty(...)
andSystem.setProperty(...)
.yaml
,.yml
and.properties
files