spring-boot-migrator
                                
                                 spring-boot-migrator copied to clipboard
                                
                                    spring-boot-migrator copied to clipboard
                            
                            
                            
                        Migrated Spring application properties must be reflected everywhere they can be used
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.
@SpringBootTest(properties={...})
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 all properties related components so that it represents a composition of all configuration-related resources (@Value, @PropertySource, Profile information, usages of a property with System. and Environment and other locations`). We then provide an API to e.g. change a property and adjust all locations.
Given
some.prop=value
@Component
@ConfigurationProperties(prefix = "some")
@Getter
@Setter
public class MyApplicationProperties {
    private String prop;
}
Apply
SpringBootConfigurationInformation configInfo = context.search(new SpringBootConfigurationInformationFinder());
configInfo.renameProperty("some.prop", "another.property")
Result
another.property=value
@Component
@ConfigurationProperties(prefix="another")
@Getter
@Setter
public class MyApplicationProperties {
    private String property;
}
What needs to be done
The enhanced SpringBootApplicationProperties class should handle all "externalized configuration"
- [ ] Update properties used in @Value
- [ ] Update @PropertySourcebeans
- [ ] Update System.getProperty(...)andSystem.setProperty(...)
- [ ] properties attribute on your tests. Available on @SpringBootTest and the test annotations for testing a particular slice of your application.
- [ ] @TestPropertySource on tests
- [ ] Devtools global settings properties in the $HOME/.config/spring-boot directory when devtools is active.
- [ ] Transparently support .yaml,.ymland.propertiesfiles
@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.