I use docker compose to run all my micro services. For each service I give it a short hostname.
version: \'2\'
services:
config:
image: springbox-config-
I find the solution. Basically, we use spring profile to enrich the bootstrap file. For example
spring:
application:
name: myservice
cloud:
config:
uri: http://config:8890
fail-fast: true
---
spring:
profiles: development
cloud:
config:
uri: http://localhost:8890
The good news is that we don't have to rewrite all properties in a profile. The default properties are inherited. For instance, when the development profile is enabled, my application name is inherited from the default one called always myservice.
To activate the profile, start the service with the following property
-Dspring.profiles.active=development