Skip to content

Commit 03e3640

Browse files
committed
Placeholder in configuration is not resolved via Holders.config - Fixes #9089
1 parent f76e0ef commit 03e3640

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

grails-bootstrap/src/main/groovy/org/grails/config/NavigableMap.groovy

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class NavigableMap implements Map<String, Object>, Cloneable {
9595
mergeMaps(this, sourceMap, parseFlatKeys)
9696
}
9797

98-
private static void mergeMaps(NavigableMap targetMap, Map sourceMap, boolean parseFlatKeys) {
98+
private void mergeMaps(NavigableMap targetMap, Map sourceMap, boolean parseFlatKeys) {
9999
sourceMap.each { Object sourceKeyObject, Object sourceValue ->
100100
String sourceKey = String.valueOf(sourceKeyObject)
101101
NavigableMap actualTarget
@@ -114,7 +114,7 @@ class NavigableMap implements Map<String, Object>, Cloneable {
114114
}
115115
}
116116

117-
private static void mergeMapEntry(NavigableMap targetMap, String sourceKey, Object sourceValue, boolean parseFlatKeys) {
117+
protected void mergeMapEntry(NavigableMap targetMap, String sourceKey, Object sourceValue, boolean parseFlatKeys) {
118118
Object currentValue = targetMap.containsKey(sourceKey) ? targetMap.get(sourceKey) : null
119119
Object newValue
120120
if(sourceValue instanceof Map) {
@@ -130,10 +130,14 @@ class NavigableMap implements Map<String, Object>, Cloneable {
130130
if (newValue == null) {
131131
targetMap.remove(sourceKey)
132132
} else {
133-
targetMap.put(sourceKey, newValue)
133+
mergeMapEntry(targetMap, sourceKey, newValue)
134134
}
135135
}
136-
136+
137+
protected Object mergeMapEntry(NavigableMap targetMap, String sourceKey, newValue) {
138+
targetMap.put(sourceKey, newValue)
139+
}
140+
137141
public Object getAt(Object key) {
138142
getProperty(String.valueOf(key))
139143
}

grails-core/src/main/groovy/org/grails/config/NavigableMapConfig.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,15 @@
3333
public abstract class NavigableMapConfig implements Config {
3434
protected ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
3535
protected ConfigurableConversionService conversionService = new DefaultConversionService();
36-
protected NavigableMap configMap = new NavigableMap();
36+
protected NavigableMap configMap = new NavigableMap() {
37+
@Override
38+
protected Object mergeMapEntry(NavigableMap targetMap, String sourceKey, Object newValue) {
39+
if(newValue instanceof CharSequence) {
40+
newValue = resolvePlaceholders(newValue.toString());
41+
}
42+
return super.mergeMapEntry(targetMap, sourceKey, newValue);
43+
}
44+
};
3745

3846
@Override
3947
public Object getAt(Object key) {

0 commit comments

Comments
 (0)