V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
cking
V2EX  ›  程序员

如何分配 dev/test/prod 三个环境下的配置文件

  •  
  •   cking · Jun 18, 2021 · 652 views
    This topic created in 1778 days ago, the information mentioned may be changed or developed.
    1.把相同 key 相同 value 的全部放在 application.yml 中,统一管理
    2.把相同的 key,不同的 value 放在对应的 application-xxx 中,由 application.yml 中的 active 控制读取不同的配置文件
    比如
    dev.yml 中就是 order.url = dev.com:8080
    test.yml 中就是 order.url = test.com:8080
    prod.yml 中就是 order.url = prod.com:8080
    ---分割线-----
    3.老大现在想做一个 共同配置文件 common.yml
    然后在里面写一个
    order.url = ${orderUrl} 这样的一个变量 然后把这个 common.yml 在启动时注入到程序中




    这样的行为可以么
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   804 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 22:33 · PVG 06:33 · LAX 15:33 · JFK 18:33
    ♥ Do have faith in what you're doing.