3

Is there any way how to "build" bootstrap.yml from multiple yaml files?

Here is my scenario, I have a bunch of micro-services and every service had the same bootstrap.yml properties expect spring.application.name.

I would like to split my bootstrap.yml into two files, base-bootstrap.yml which contains config service configuration like URI, password ... etc and then bootstrap.yml which could contain spring.application.name or whatever else.

base-bootstrap.yml file could be externalized in some dependency jar and should be used like default, bootstrap.yml should override any value. Here is some sample:

base-boostrap.yml

spring:
  cloud:
    config:
      label: develop
      uri: http://config
      password: ${CONFIG_SERVICE_PASSWORD:password}
      fail-fast: true
---
spring:
  profiles: production
  cloud:
    config:
      label: master
      password: ${CONFIG_SERVICE_PASSWORD}
---
spring:
  profiles: development
  cloud:
    config:
      uri: http://localhost:8888

bootstrap.yml

spring:
  application.name: sample-service
  cloud:
    config:
      label: release/1.0.1
---
spring:
  profiles: production
  cloud:
    config:
      label: 1.1.0

Could anyone please guide me how to do it?

Mehraj Malik
  • 14,872
  • 15
  • 58
  • 85
Mario Doskoc
  • 131
  • 6
  • https://cloud.spring.io/spring-cloud-static/spring-cloud.html#customizing-bootstrap-property-sources – Darren Forsythe Feb 27 '18 at 10:43
  • I have tried this, but it doesn't override bootstrap config, I think spring boot probably doesn't support such functionality. – Mario Doskoc Mar 05 '18 at 08:12
  • https://stackoverflow.com/questions/40981861/how-do-you-properly-set-different-spring-profiles-in-bootstrap-file-for-spring – pramodc84 May 18 '18 at 04:39

0 Answers0