@@ -34,6 +34,7 @@ import org.springframework.context.event.ApplicationContextEvent
3434import org.springframework.context.event.ContextClosedEvent
3535import org.springframework.context.event.ContextRefreshedEvent
3636import org.springframework.core.convert.converter.Converter
37+ import org.springframework.core.convert.support.ConfigurableConversionService
3738import org.springframework.core.env.AbstractEnvironment
3839import org.springframework.core.env.ConfigurableEnvironment
3940import org.springframework.core.env.EnumerablePropertySource
@@ -109,16 +110,17 @@ class GrailsApplicationPostProcessor implements BeanDefinitionRegistryPostProces
109110
110111 protected void loadApplicationConfig () {
111112 org.springframework.core.env.Environment environment = applicationContext. getEnvironment()
113+ ConfigurableConversionService conversionService = null
112114 if (environment instanceof ConfigurableEnvironment ) {
113115 if (environment instanceof AbstractEnvironment ) {
114- def cs = environment. getConversionService()
115- cs . addConverter(new Converter<NavigableMap.NullSafeNavigator , String > () {
116+ conversionService = environment. getConversionService()
117+ conversionService . addConverter(new Converter<NavigableMap.NullSafeNavigator , String > () {
116118 @Override
117119 public String convert (NavigableMap.NullSafeNavigator source ) {
118120 return null ;
119121 }
120122 });
121- cs . addConverter(new Converter<NavigableMap.NullSafeNavigator , Object > () {
123+ conversionService . addConverter(new Converter<NavigableMap.NullSafeNavigator , Object > () {
122124 @Override
123125 public Object convert (NavigableMap.NullSafeNavigator source ) {
124126 return null ;
@@ -138,7 +140,11 @@ class GrailsApplicationPostProcessor implements BeanDefinitionRegistryPostProces
138140 }
139141 }
140142 }
141- ((DefaultGrailsApplication )grailsApplication). config = new PropertySourcesConfig (propertySources)
143+ def config = new PropertySourcesConfig (propertySources)
144+ if (conversionService != null ) {
145+ config. setConversionService( conversionService )
146+ }
147+ ((DefaultGrailsApplication )grailsApplication). config = config
142148 }
143149 }
144150
0 commit comments