见识superDiamond的强悍

来源:互联网 发布:北大青鸟网络授课 编辑:程序博客网 时间:2024/05/01 00:27

简介:

super-diamond

  • 配置管理系统提供系统参数配置管理,例如数据库的配置信息等,配置参数修改以后可以实时推送到客户端(基于netty4), 方便系统动态修改运行参数。

  • 可以建多个项目,每个项目分为三种profile(development、test、production), 能够控制profile 级别的权限。

  • 所有参数均由development profile配置,test和production profile继承development profile配置,也可以覆盖其配置。 test和production profile只提供修改功能。

  • client 备份配置信息到本地文件系统,如果server不可用,可以使用本地备份。client 能够定时重连server,保证client高可用。

  • client 提供ConfigurationListener,当某个属性发生变化(add、update、clear), ConfigurationListener能够接收到ConfigurationEvent。

如何使用???

第一步:引入jar包:

<dependency>

  <groupId>com.github.diamond</groupId>
  <artifactId>super-diamond-client</artifactId>
  <version>1.2.1-SNAPSHOT</version>

 </dependency>


第二步:创建配置文件。基于spring的。


<bean class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer">    <property name="properties" ref="propertiesConfiguration" /></bean>

<!--SuperDiamond的配置信息--><bean id="propertiesConfiguration" class="com.github.diamond.client.PropertiesConfigurationFactoryBean">    <constructor-arg index="0" value="xxx.xxx.xxx.xxx" />    <constructor-arg index="1" value="8283" />           <!--服务器的端口号-->    <constructor-arg index="2" value="xxx" />    <!--项目名称-->    <constructor-arg index="3" value="development" />   <!--项目文件名(开发环境、测试环境、灰度环境、生产环境)-->    <constructor-arg index="4" value="base" />           <!--模块名--></bean>
关于这个index 到底有几个这个看你自己的情况来进行配置。

配置都是在此处,配置界面如下:



第三步:

直接把这个配置文件import到spring的配置文件里即可。



了解更过知识也可参考以下链接:

http://www.cnblogs.com/dhsunny/p/SuperDiamond.html   

http://www.oschina.net/p/spark-project





原创粉丝点击