(三十三)Bee配置文件支持多环境差异化配置

205 篇文章 0 订阅
23 篇文章 0 订阅

Bee从V1.11开始,配置文件支持多环境差异化配置。

#since V1.11
#1.base main and Override with active, 2.rebase to active(other file)
#1 : main file + other file; 2 : just active file(other file);    if do not set , will use mail file.
#bee.profiles.type=0
#命名规则 name rule: bee-{active}.properties
#bee.profiles.active = test

1、 比如所有的配置,开发环境,生产环境,除了数据库连接信息,其它的都相同。

在bee.properties中,配置:

bee.profiles.type=1
#命名规则 name rule: bee-{active}.properties
bee.profiles.active = prod

以上配置,表示以bee.properties为主,不一样的信息可以放在 bee-prod.properties中。

2、在bee.properties中,配置:

bee.profiles.type=2
#命名规则 name rule: bee-{active}.properties
bee.profiles.active = test

则表示,会使用bee-test.properties的配置信息,而bee.properties则不再使用。

另外,Bee支持设置bee.properties所在的文件夹位置。

实例中bee.properties放在:D:\temp中。

		HoneyConfig.getHoneyConfig().resetBeeProperties("D:\\temp\\");
        suid.select(new TestUser()); // 对DB操作的示例
/**
	 * 使用指定路径的bee.properties进行配置.set the folder path of bee.properties
	 * 若使用第三方框架管理配置,不建议在此处重置配置.
	 * @param folderPath bee.properties所在的路径. the folder path of bee.properties
	 * @since 1.9.8
	 */
	public void resetBeeProperties(String folderPath) {
     。。。
    }

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值