Resource依赖注入支持system.property.开头的系统变量
This commit is contained in:
@@ -576,6 +576,10 @@ public final class ResourceFactory {
|
|||||||
}
|
}
|
||||||
boolean autoregnull = true;
|
boolean autoregnull = true;
|
||||||
final String rcname = tname;
|
final String rcname = tname;
|
||||||
|
Object rs;
|
||||||
|
if (rcname.startsWith("system.property.")) {
|
||||||
|
rs = System.getProperty(rcname.substring("system.property.".length()));
|
||||||
|
} else {
|
||||||
ResourceEntry re = findEntry(rcname, genctype);
|
ResourceEntry re = findEntry(rcname, genctype);
|
||||||
if (re == null) {
|
if (re == null) {
|
||||||
if (rcname.startsWith("property.")) {
|
if (rcname.startsWith("property.")) {
|
||||||
@@ -616,8 +620,8 @@ public final class ResourceFactory {
|
|||||||
}
|
}
|
||||||
if (re == null) continue;
|
if (re == null) continue;
|
||||||
re.elements.add(new ResourceElement<>(src, field));
|
re.elements.add(new ResourceElement<>(src, field));
|
||||||
|
rs = re.value;
|
||||||
Object rs = re.value;
|
}
|
||||||
if (rs != null && !rs.getClass().isPrimitive() && classtype.isPrimitive()) {
|
if (rs != null && !rs.getClass().isPrimitive() && classtype.isPrimitive()) {
|
||||||
if (classtype == int.class) {
|
if (classtype == int.class) {
|
||||||
rs = Integer.decode(rs.toString());
|
rs = Integer.decode(rs.toString());
|
||||||
|
|||||||
Reference in New Issue
Block a user