Skip to content

Commit

Permalink
配置和配置项可支持自定义app #147
Browse files Browse the repository at this point in the history
  • Loading branch information
knightliao committed Sep 5, 2016
1 parent e553fab commit 9122064
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
*/
String version() default "";

/**
* 版本,默认为用户指定的app
*/
String app() default "";

/**
* 以"/"开头则是系统的全路径,否则则是相对于classpath的路径,默认是classpath根路径
* 注意:根路径要注意是否有权限,否则会出现找不到路径,推荐采用相对路径
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
*/
String env() default "";

/**
* 版本,默认为用户指定的app
*/
String app() default "";

/**
* 版本,默认为用户指定的版本
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ private static DisconfCenterFile transformScanFile(Class<?> disconfFileClass, Se
//
// disConfCommonModel
DisConfCommonModel disConfCommonModel =
makeDisConfCommonModel(disconfFileAnnotation.env(), disconfFileAnnotation.version());
makeDisConfCommonModel(disconfFileAnnotation.app(), disconfFileAnnotation.env(), disconfFileAnnotation
.version());
disconfCenterFile.setDisConfCommonModel(disConfCommonModel);

// Remote URL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ private static DisconfCenterItem transformScanItem(Method method) {

//
// disConfCommonModel
DisConfCommonModel disConfCommonModel = makeDisConfCommonModel(disconfItem.env(), disconfItem.version());
DisConfCommonModel disConfCommonModel = makeDisConfCommonModel(disconfItem.app(), disconfItem.env(),
disconfItem.version());
disconfCenterItem.setDisConfCommonModel(disConfCommonModel);

// Disconf-web url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ public class StaticScannerMgrImplBase {
/**
* env/version 默认是应用整合设置的,但用户可以在配置中更改它
*/
protected static DisConfCommonModel makeDisConfCommonModel(String env, String version) {
protected static DisConfCommonModel makeDisConfCommonModel(String app, String env, String version) {

DisConfCommonModel disConfCommonModel = new DisConfCommonModel();

// app
disConfCommonModel.setApp(DisClientConfig.getInstance().APP);
if (!app.isEmpty()) {
disConfCommonModel.setApp(app);
} else {
disConfCommonModel.setApp(DisClientConfig.getInstance().APP);
}

// env
if (!env.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static DisconfCenterBaseModel getDisconfCenterFile(String fileName) {

//
// disConfCommonModel
DisConfCommonModel disConfCommonModel = makeDisConfCommonModel("", "");
DisConfCommonModel disConfCommonModel = makeDisConfCommonModel("", "", "");
disconfCenterFile.setDisConfCommonModel(disConfCommonModel);

// Remote URL
Expand Down

0 comments on commit 9122064

Please sign in to comment.