bitget

Bitget交易所

Bitget交易所是全球前4大交易所之一、打新活动多、领空投到手软,新用户注册即可领取BGB空投

点击注册 立即下载

git 地址 https://github.com/melin/super-diamond

git上的使用说明有点问题,括号里是我在实际使用过程中自己的改动,供参考:

super-diamond 结合springboot的使用经验(用过的都说好)

下载super-diamond代码: git clone https://github.com/melin/super-diamond.git

进入super-diamond目录,构建super-diamond父工程: mvn install (install如果不成功,把client包里的test删除)

super-diamond-server中嵌入jetty运行,构建部署包:mvn install assembly:single -Pproduction,生成super-diamond-server-${version}-bin.tar.gz文件, 解压运行bin/server.sh start命令。(3要在4,5建表后才能执行,而且要将super-dimond-server包打包为super-diamond-server-1.3.3.jar放置在3中解压后的lib文件夹中。)

在conf\META-INF\scripts目录中,提供mysql和oracle建表脚本,理论也支持其它数据库,在conf\META-INF\res\config-production.properties文件中修改数据库配置。(这里面的数据库是super-diamond保存元数据的地方,也是设置的参数保保存的地方,port为client端和server端之间交流用的)

在conf_user表中添加用户admin,密码000000的加密值为:670b14728ad9902aecba32e22fa4f6bd, mysql脚本: insert into conf_user(id,USER_code,USER_NAME,PASSWORD,CREATE_TIME) values(1,'admin','admin','670b14728ad9902aecba32e22fa4f6bd',current_timestamp() );commit;

访问super-diamond-server,jetty默认端口为8090,可以在:conf/META-INF/res/jetty.properties中修改。http://localhost:8090/superdiamond

super-diamond 结合springboot的使用经验(用过的都说好)

super-diamond 结合springboot的使用经验(用过的都说好)

2. super-diamond client在springboot中使用

此git项目未在maven中央仓库里发布,所以要在项目中使用client端,必须自己将super-diamond-client打包放置到自己maven的仓库。

在项目中添加依赖:

super-diamond 结合springboot的使用经验(用过的都说好)

git项目介绍中只写了client的直接获取和在spring中的使用,如果是springboot项目,没有spring配置文件的话,可以仿照项目文档中spring 配置xml bean的方法建立配置类,加载super-diamond中的参数:

@Configurationpublic class ApplicationConfigurer {  @Bean public PropertySourcesPlaceholderConfigurer createPropertySourcesPlaceholderConfigurer() { PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer(); PropertiesConfiguration config = new PropertiesConfiguration("192.168.2.233", 8283, "test", "development"); config.addConfigurationListener(new ConfigurationListenerTest()); propertyPlaceholderConfigurer.setProperties(config.getProperties()); return propertyPlaceholderConfigurer; }}

这样除了sprignboot的application.yml中配置的参数外,还可以加上我们在super-diamond中配置的参数也可以同时加载。

可以添加参数监听:

public class ConfigurationListenerTest implements ConfigurationListener {

@Override

public void configurationChanged(ConfigurationEvent event) {

System.out.println(event.getType().name() + " " + event.getPropertyName() + " " + event.getPropertyValue());

}

}

这样在server端更改参数后,应用中可以及时感知,可以用在一些功能控制开关的地方。

bitget

Bitget交易所

Bitget交易所是全球前4大交易所之一、打新活动多、领空投到手软,新用户注册即可领取BGB空投

点击注册 立即下载

Bitget交易所

Bitget交易所V

地址上的使用说明有点问题括号里是我在实际使用过程中自己的改动供参考项目介绍中只写了的直接获取和在中的使用如果是项目没有配置文件的话可以仿照项目文档中配置的方法建立配置类加载中的参数这样除了的中配置的参数外还可以加上我们在中配置的参数也可以同时加载可以添加参数监听这样在端更改参数后应用中可以及时感知可...

文章数
0 评论数
浏览数

最近发表

热门文章

标签列表

目录[+]