Skip to content

Commit

Permalink
fix bug: 如果同时使用注解式和XML式,XML式也会被reload
Browse files Browse the repository at this point in the history
  • Loading branch information
knightliao committed Jun 27, 2016
1 parent 7079a78 commit d725b85
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class DisconfCenterFile extends DisconfCenterBaseModel {
// 文件名
private String fileName;

// 复制到指定的路径下
private String copy2TargetDirPath;

// 文件类型
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,14 @@ public void storeOneFile(DisconfCenterBaseModel disconfCenterBaseModel) {

if (confFileMap.containsKey(fileName)) {

LOGGER.error("There are two same fileName key!!!! " + "first: " + confFileMap.get(fileName).toString() +
"\n, Second: " + disconfCenterFile.toString());
LOGGER.warn("There are two same fileName key!!!! " + fileName);
DisconfCenterFile existCenterFile = confFileMap.get(fileName);

// 如果是 同时使用了 注解式 和 非注解式 两种方式,则当修改时也要 进行 XML 式 reload
if (disconfCenterFile.isTaggedWithNonAnnotationFile()) {
existCenterFile.setIsTaggedWithNonAnnotationFile(true);
}

} else {
confFileMap.put(fileName, disconfCenterFile);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,10 @@ public void inject2Store(String fileName, DisconfValue disconfValue) {
}
}

// 注解式
// 使用过 XML式配置
if (disconfCenterFile.isTaggedWithNonAnnotationFile()) {

//
// 非注解式 或者 注解式的域集合为空,则将 文件内容写到配置库里
//

if (disconfCenterFile.getObject() == null &&
disconfCenterFile.getSupportFileTypeEnum().equals(SupportFileTypeEnum.PROPERTIES)) {
if (disconfCenterFile.getSupportFileTypeEnum().equals(SupportFileTypeEnum.PROPERTIES)) {
// 如果是采用XML进行配置的,则需要利用spring的reload将数据reload到bean里
ReloadConfigurationMonitor.reload();
}
Expand Down

0 comments on commit d725b85

Please sign in to comment.