You can use Profiles for this.
With application.properties files, you can define a file for each Profile , for example:
application.properties
Spring will translate the files and use them like this:
application.properties
This solution works, but you must keep a separate file for each group.
There is another way: you can use only one YAML file instead of several properties files. Just replace application.properties with application.yml and do something like this:
server: address: 192.168.1.100 --- spring: profiles: development server: address: 127.0.0.1 --- spring: profiles: production server: address: 192.168.1.120
You can read the help documentation for more information on Using YAML instead of Properties and Multidisciplinary YAML Documents .
Esala source share