From 3990bb485e63a86df8a074e8034a74b11a29cc4b Mon Sep 17 00:00:00 2001 From: Chris Bono Date: Mon, 17 Apr 2023 22:49:12 -0500 Subject: [PATCH] GH-2705: AOT support complex binding properties - Sets the conversion service on AOT child binder contexts to allow complex properties to be bound in extended binding props Fixes #2705 --- .../cloud/stream/binder/DefaultBinderFactory.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/DefaultBinderFactory.java b/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/DefaultBinderFactory.java index 21f9c7fdf..dfdc341de 100644 --- a/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/DefaultBinderFactory.java +++ b/core/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/DefaultBinderFactory.java @@ -543,9 +543,11 @@ public class DefaultBinderFactory implements BinderFactory, DisposableBean, Appl */ GenericApplicationContext createUnitializedContextForAOT(String configurationName, Map binderProperties, BinderConfiguration binderConfiguration) { - GenericApplicationContext binderContext = new GenericApplicationContext(); - + // Set the conversion service on the binder producing context to handle complex properties + if (this.context != null) { + binderContext.getBeanFactory().setConversionService(this.context.getBeanFactory().getConversionService()); + } MapPropertySource binderPropertySource = new MapPropertySource(configurationName, binderProperties); binderContext.getEnvironment().getPropertySources().addFirst(binderPropertySource); binderContext.setDisplayName(configurationName + "_context");