V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
zhuwd
V2EX  ›  Java

spring 多环境配置管理最佳实践是什么?

  •  
  •   zhuwd · 2020-04-02 17:09:10 +08:00 · 3070 次点击
    这是一个创建于 1456 天前的主题,其中的信息可能已经有所发展或是发生改变。

    遇到越来越复杂的项目,不同的环境、不同的分支都会有不同的配置文件,管理起来也越来越混乱,想请教各位前辈有没有比较好的管理思路

    12 条回复    2020-04-03 14:25:19 +08:00
    Smilencer
        1
    Smilencer  
       2020-04-02 17:22:27 +08:00
    maven profile 或者 spring profile,二选一
    Jafee
        2
    Jafee  
       2020-04-02 18:03:16 +08:00
    使用 spring profile 方便点吧,每个环境一个配置文件。
    Yuicon
        3
    Yuicon  
       2020-04-02 18:06:24 +08:00
    配置中心
    saximoer
        4
    saximoer  
       2020-04-02 18:11:04 +08:00
    配置中心+10086
    根据 profile 区分即可
    sprit
        5
    sprit  
       2020-04-02 18:11:33 +08:00
    Apollo
    rockyou12
        6
    rockyou12  
       2020-04-02 18:11:48 +08:00
    spring cloud config + profile 功能可以拯救你
    huskyui
        7
    huskyui  
       2020-04-02 18:12:40 +08:00
    后辈来一句 spring cloud config
    Aresxue
        8
    Aresxue  
       2020-04-02 18:12:47 +08:00
    不超过十个 spring 自己够用, 超过十个上个配置中心好了, 比如 nacos
    chendy
        9
    chendy  
       2020-04-02 18:27:09 +08:00
    spring 自己的 profile + 配置中心
    xuanbg
        10
    xuanbg  
       2020-04-02 23:30:35 +08:00
    最简单的解决方案就是 spring cloud config
    yiyi11
        11
    yiyi11  
       2020-04-03 05:37:51 +08:00 via Android
    用配置中心,国产的 nacos,apollo,外国的 consul 。纯用做配置管理的话 apollo 最好,但是 nacos 和 consul 还有个好处是它们还是服务注册中心,所以看你的项目技术栈选择。
    WhereverYouGo
        12
    WhereverYouGo  
       2020-04-03 14:25:19 +08:00
    Apollo +1
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5614 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 01:42 · PVG 09:42 · LAX 18:42 · JFK 21:42
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.