Skip to content

Commit f76e0ef

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

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

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

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@
1515
*/
1616
package org.grails.config;
1717

18-
import grails.config.Config;
19-
import grails.util.*;
18+
import grails.util.GrailsStringUtils;
2019
import org.codehaus.groovy.runtime.DefaultGroovyMethods;
2120
import org.springframework.core.convert.ConversionException;
2221
import org.springframework.core.convert.support.ConfigurableConversionService;
23-
import org.springframework.core.convert.support.DefaultConversionService;
2422
import org.springframework.core.env.*;
25-
import org.springframework.util.ClassUtils;
2623

27-
import java.util.*;
24+
import java.util.Collections;
25+
import java.util.LinkedHashMap;
26+
import java.util.List;
27+
import java.util.Map;
2828

2929
/**
3030
* @author Graeme Rocher
@@ -89,11 +89,15 @@ protected void initializeFromPropertySources(PropertySources propertySources) {
8989
private void mergeEnumerablePropertySource(EnumerablePropertySource enumerablePropertySource) {
9090
Map<String, Object> map = new LinkedHashMap<String, Object>();
9191
for(String propertyName : enumerablePropertySource.getPropertyNames()) {
92+
Object value = enumerablePropertySource.getProperty(propertyName);
93+
if(value instanceof CharSequence) {
94+
value = resolvePlaceholders(value.toString());
95+
}
9296
if(prefix != null) {
93-
map.put(prefix + '.' + propertyName, enumerablePropertySource.getProperty(propertyName));
97+
map.put(prefix + '.' + propertyName, value);
9498
}
9599
else {
96-
map.put(propertyName, enumerablePropertySource.getProperty(propertyName));
100+
map.put(propertyName, value);
97101
}
98102
}
99103

@@ -111,7 +115,10 @@ public void setConversionService(ConfigurableConversionService conversionService
111115

112116
@Override
113117
public String resolvePlaceholders(String text) {
114-
return propertySourcesPropertyResolver.resolvePlaceholders(text);
118+
if(!GrailsStringUtils.isBlank(text)) {
119+
return propertySourcesPropertyResolver.resolvePlaceholders(text);
120+
}
121+
return text;
115122
}
116123

117124
@Override

0 commit comments

Comments
 (0)