spring boot - application yml for each developer

Viewed 405

In my work the fields in application.yml are dynamics and each developer have another (dynamic) configuration. So, we have the general yml section, that relevant for all of us (and have updates from time to time) and the “private profile”

Like this:

spring:
  profiles: default
  configuration:
    ...
    ...

spring:
  profiles: development1
configuration: ...

spring:
  profiles: development2
configuration: ...

We have “small” problems with this (mistakes, conflicts, etc.) and we’re look for solution. I think about separate yml file for each developer, such as:

spring:
  profiles: development1
configuration:
  yml-file: app_dev1.yml

spring:
  profiles: development2
configuration:
  yml-file: app_dev2.yml

but didn’t find how to do this…

Will be glad to know if it can be done? (or you have another way to separate the yml between us).

We do not want to set an application yaml with annotation (git issues again..), something like Environment Variables...

1 Answers

Spring boot by default loads application.yaml but in addition if you run with --spring.profiles.active=dev1 it will load file application-dev1.yaml

So you could create yaml file per developer + have some "common" configuration in application.yaml

With such an approach you won't need lines like:

spring:
  profiles: dev1

... in any of the yaml files

Related