Spring cloud config in local dev mode

痴心易碎 提交于 2019-12-25 05:05:35

问题


Is it possible to control if the application requires spring-config-server based on profile.

I want to pick properties from resource/... in say local-dev profile and use cloud-config only with a profile where there would be a config-server running.


回答1:


You can disable using config-server for a specific profile. Please try to define the properties in bootstrap.yml like below. Please note, we should configure these settings only in bootstrap.yml. Setting these properties in application.yml will not work. In this case, local profile will be running only with local profiles in /resources folder. In dev profile, properties from config-server will override properties from resources/ folder.

spring:
  profiles: local
  cloud:
    config:
      enabled: false
---
spring:
  profiles: dev
  cloud:
    config:
      uri: http://<your config server>


来源:https://stackoverflow.com/questions/43636201/spring-cloud-config-in-local-dev-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!