task-sdk


License

License

Categories

Categories

ORM Data
GroupId

GroupId

cn.dceast.platform
ArtifactId

ArtifactId

task-sdk
Last Version

Last Version

2.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

task-sdk
task-sdk
Project URL

Project URL

https://github.com/qingliuyun
Source Code Management

Source Code Management

https://github.com/qingliuyun/platform-config-client

Download task-sdk

How to add to project

<!-- https://jarcasting.com/artifacts/cn.dceast.platform/task-sdk/ -->
<dependency>
    <groupId>cn.dceast.platform</groupId>
    <artifactId>task-sdk</artifactId>
    <version>2.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/cn.dceast.platform/task-sdk/
implementation 'cn.dceast.platform:task-sdk:2.0.0'
// https://jarcasting.com/artifacts/cn.dceast.platform/task-sdk/
implementation ("cn.dceast.platform:task-sdk:2.0.0")
'cn.dceast.platform:task-sdk:jar:2.0.0'
<dependency org="cn.dceast.platform" name="task-sdk" rev="2.0.0">
  <artifact name="task-sdk" type="jar" />
</dependency>
@Grapes(
@Grab(group='cn.dceast.platform', module='task-sdk', version='2.0.0')
)
libraryDependencies += "cn.dceast.platform" % "task-sdk" % "2.0.0"
[cn.dceast.platform/task-sdk "2.0.0"]

Dependencies

compile (7)

Group / Artifact Type Version
org.quartz-scheduler : quartz jar 2.2.1
org.quartz-scheduler : quartz-jobs jar 2.2.1
org.quartz-scheduler : quartz jar 2.2.1
ch.qos.logback : logback-classic jar 1.1.3
com.alibaba : fastjson jar 1.2.6
commons-beanutils : commons-beanutils jar 1.9.2
org.mongodb : mongo-java-driver jar 2.13.2

Project Modules

There are no modules declared in this project.

本工程为oss平台提供的配置中心的客户端,主要目的为了部署在平台上的应用可以从配置中心获取配置。

支持OSS平台配置中心、本地properties文件。默认读取工程中的properties文件,最少要有一个application.properties

客户端集成

Spring boot工程,只需要将此工程jar包放入工程即可。pom.xml 中添加如下依赖

<dependency>
    <groupId>cn.dceast.platform</groupId>
    <artifactId>platform-config-client</artifactId>
    <version>2.3.0</version>
</dependency>

普通Spring工程,需要额外按照如下方式配置bean

<bean id="propertyPlaceholderConfigAdapter" class="cn.dceast.platform.config.adapter.SpringPropertyPlaceholderConfigAdapter">
    <property name="loadProperties">
        <list>
            <value>application.properties</value>
            <value>cas.properties</value>
        </list>
    </property>
</bean>

普通java web工程

使用 CommonConfigAdapter类。此类型readPropertiesByEnvironment()方法可以根据环境变量决定是读取本地properties文件还是读取配置中心。 此方法默认读取application.properties。可以自定义设置此类的loadProperties属性。

对于静态资源中,需要替换属性变量 在web.xml中如下配置

<context-param>
    <param-name>replaceFiles</param-name>
    <param-value>1.js,2.js,3.css</param-value>
</context-param>
<context-param>
    <param-name>replaceFileStrs</param-name>
    <param-value>co.test.helper</param-value>
</context-param>
<context-param>
    <param-name>replaceProperties</param-name>
    <param-value>application.properties,cas.properties</param-value>
</context-param>

<listener>
    <listener-class>cn.dceast.platform.config.adapter.listener.ReplaceStaticResourceListener</listener-class>
</listener>

replaceFiles:需要替换的静态文件清单。
replaceFileStrs:需要替换的属性。
replaceProperties:默认替换的属性值的来源。

应用详情页面设置环境变量

  *  CONFIG_CENTER_ENABLE = true 开启从配置中心读配置
  *  CONFIG_CENTER_HOST = "http://221.178.232.93:86/oss-config-center" 配置中心的host
  *  CONFIG_PROJECT_NAME = "demo-huajian"  项目名称
  *  CONFIG_PROFILE_NAME = "profile03"  配置组名称
  *  CONFIG_SECRET_KEY = "rh2p6w6sgas" 配置组安全key

Versions

Version
2.0.0