GH-1979 Fix SpelConverter registration for child context
Basically the code was already fixed and working for Spel properties in multi-binder configuration. However the actual code was included in a wrong block and because of it was working conditionally based on an unrelated condition. This fixes it Resolves #1979
This commit is contained in:
@@ -351,8 +351,8 @@ public class DefaultBinderFactory implements BinderFactory, DisposableBean, Appl
|
|||||||
private void customizeParentChildContextRelationship(SpringApplicationBuilder applicationBuilder, ApplicationContext context) {
|
private void customizeParentChildContextRelationship(SpringApplicationBuilder applicationBuilder, ApplicationContext context) {
|
||||||
if (context != null) {
|
if (context != null) {
|
||||||
Map<String, ListenerContainerCustomizer> customizers = context.getBeansOfType(ListenerContainerCustomizer.class);
|
Map<String, ListenerContainerCustomizer> customizers = context.getBeansOfType(ListenerContainerCustomizer.class);
|
||||||
if (!CollectionUtils.isEmpty(customizers)) {
|
applicationBuilder.initializers(childContext -> {
|
||||||
applicationBuilder.initializers(childContext -> {
|
if (!CollectionUtils.isEmpty(customizers)) {
|
||||||
for (Entry<String, ListenerContainerCustomizer> customizerEntry : customizers.entrySet()) {
|
for (Entry<String, ListenerContainerCustomizer> customizerEntry : customizers.entrySet()) {
|
||||||
ListenerContainerCustomizer customizerWrapper = new ListenerContainerCustomizer() {
|
ListenerContainerCustomizer customizerWrapper = new ListenerContainerCustomizer() {
|
||||||
@Override
|
@Override
|
||||||
@@ -372,11 +372,11 @@ public class DefaultBinderFactory implements BinderFactory, DisposableBean, Appl
|
|||||||
((GenericApplicationContext) childContext).registerBean(customizerEntry.getKey(),
|
((GenericApplicationContext) childContext).registerBean(customizerEntry.getKey(),
|
||||||
ListenerContainerCustomizer.class, () -> customizerWrapper);
|
ListenerContainerCustomizer.class, () -> customizerWrapper);
|
||||||
}
|
}
|
||||||
GenericConversionService cs = (GenericConversionService) ((GenericApplicationContext) childContext).getBeanFactory().getConversionService();
|
}
|
||||||
SpelConverter spelConverter = new SpelConverter();
|
GenericConversionService cs = (GenericConversionService) ((GenericApplicationContext) childContext).getBeanFactory().getConversionService();
|
||||||
cs.addConverter(spelConverter);
|
SpelConverter spelConverter = new SpelConverter();
|
||||||
});
|
cs.addConverter(spelConverter);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user