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
This commit is contained in:
Chris Bono
2023-04-17 22:49:12 -05:00
committed by Soby Chacko
parent 0b5ae251f9
commit 3990bb485e

View File

@@ -543,9 +543,11 @@ public class DefaultBinderFactory implements BinderFactory, DisposableBean, Appl
*/
GenericApplicationContext createUnitializedContextForAOT(String configurationName,
Map<String, Object> 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");