提交 3d1f8258 authored 作者:  狄熙卜's avatar 狄熙卜

修改配置文件读取方式

上级 e961d5e5
...@@ -9,6 +9,7 @@ import org.bouncycastle.crypto.signers.ECNRSigner; ...@@ -9,6 +9,7 @@ import org.bouncycastle.crypto.signers.ECNRSigner;
import org.dom4j.Document; import org.dom4j.Document;
import org.dom4j.Element; import org.dom4j.Element;
import org.dom4j.io.SAXReader; import org.dom4j.io.SAXReader;
import org.dom4j.tree.DefaultElement;
import org.dom4j.tree.DefaultText; import org.dom4j.tree.DefaultText;
import org.reflections.Reflections; import org.reflections.Reflections;
import org.reflections.scanners.FieldAnnotationsScanner; import org.reflections.scanners.FieldAnnotationsScanner;
...@@ -342,8 +343,11 @@ public class DbEncryptXmlConfig { ...@@ -342,8 +343,11 @@ public class DbEncryptXmlConfig {
if(root != null) { if(root != null) {
Element globalEnableFields = root.element(fieldName); Element globalEnableFields = root.element(fieldName);
if(globalEnableFields != null){ if(globalEnableFields != null){
//((DefaultText) ((DefaultElement) globalEnableFields).content).text.trim(); String value = "";
String value = globalEnableFields.elementTextTrim("value"); if (CollectionUtils.isNotEmpty(((DefaultElement) globalEnableFields).content())) {
value = ((DefaultText) ((DefaultElement) globalEnableFields).content().get(0)).getText().trim();
}
// String value = globalEnableFields.elementTextTrim("value");
if(StringUtils.isNotBlank(value)){ if(StringUtils.isNotBlank(value)){
String[] split = value.split(","); String[] split = value.split(",");
if(split != null && split.length > 0){ if(split != null && split.length > 0){
...@@ -409,8 +413,10 @@ public class DbEncryptXmlConfig { ...@@ -409,8 +413,10 @@ public class DbEncryptXmlConfig {
if(root != null) { if(root != null) {
Element globalEnableFields = root.element(fieldName); Element globalEnableFields = root.element(fieldName);
if(globalEnableFields != null){ if(globalEnableFields != null){
//((DefaultText) ((DefaultElement) globalEnableFields).content).text.trim(); if (CollectionUtils.isNotEmpty(((DefaultElement) globalEnableFields).content())) {
value = globalEnableFields.elementTextTrim("value"); value = ((DefaultText) ((DefaultElement) globalEnableFields).content().get(0)).getText().trim();
}
// value = globalEnableFields.elementTextTrim("value");
} }
} }
} }
...@@ -429,8 +435,11 @@ public class DbEncryptXmlConfig { ...@@ -429,8 +435,11 @@ public class DbEncryptXmlConfig {
if(root != null) { if(root != null) {
Element globalEnableFields = root.element(fieldName); Element globalEnableFields = root.element(fieldName);
if(globalEnableFields != null){ if(globalEnableFields != null){
//((DefaultText) ((DefaultElement) globalEnableFields).content).text.trim(); String stringVal = "";
String stringVal = globalEnableFields.elementTextTrim("value"); if (CollectionUtils.isNotEmpty(((DefaultElement) globalEnableFields).content())) {
stringVal = ((DefaultText) ((DefaultElement) globalEnableFields).content().get(0)).getText().trim();
}
// String stringVal = globalEnableFields.elementTextTrim("value");
if(StringUtils.isNotBlank(stringVal) && StringUtils.equals("true",stringVal)){ if(StringUtils.isNotBlank(stringVal) && StringUtils.equals("true",stringVal)){
return true; return true;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论