优化cache创建逻辑

This commit is contained in:
zhouhao
2016-12-24 00:31:46 +08:00
parent 6c76715758
commit c3ac262d24
2 changed files with 3 additions and 2 deletions

View File

@@ -21,7 +21,6 @@ package org.hswebframework.web.bean.config;
import org.hswebframework.web.commons.beans.GenericBean;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

View File

@@ -91,7 +91,9 @@ public class SimpleConfigBean extends SimpleGenericBean<String> implements Confi
if (cache == null) {
synchronized (this) {
if (cache == null) {
if (content == null || content.isEmpty()) cache = new HashMap<>();
if (content == null || content.isEmpty()) {
return null;
}
cache = content.stream()
.collect(Collectors.toMap(ConfigContent::getKey, content -> content));
}