rewrite-spring icon indicating copy to clipboard operation
rewrite-spring copied to clipboard

Separating application.properties into different files based on profile

Open ishish07 opened this issue 1 year ago • 1 comments

What problem are you trying to solve?

Application.Properties files sometimes specify different profiles and/or environments using property file separators (#--- or !---) as seen here:

Sometimes, it is preferred to separate these profiles into their own application-profile.properties files for organizational purposes. The names of these separate profiles are configured by the spring.config.activate.on-profile property.

What precondition(s) should be checked before applying this recipe?

If an application.properties file exists in the codebase.

Describe the situation before applying the recipe

BeforeRecipe

Describe the situation after applying the recipe

AfterRecipe

Any additional context

This is similar to the yaml document separator

During my internship this summer, I had to manually separate these files during our migration to Java 21. I have created a recipe so that others do not have to manually separate files and delete content in application.properties.

Are you interested in contributing this recipe to OpenRewrite?

Yes I am!

I have written the code, ran tests, and would like to create a draft pull request.

ishish07 avatar Aug 11 '24 19:08 ishish07

Thanks for the suggestion & offer to help @ishish07 ! I had no idea the same was supported for properties files. Yes makes sense to do offer the same there, and I look forward to your PR.

timtebeek avatar Aug 11 '24 19:08 timtebeek