Add AOT support for by-type RuntimeBeanReference

Closes gh-28841
This commit is contained in:
Stephane Nicoll
2022-07-19 17:56:35 +02:00
parent cd4f4d978d
commit 1acb41ff43
2 changed files with 32 additions and 5 deletions

View File

@@ -513,7 +513,12 @@ class BeanDefinitionPropertyValueCodeGenerator {
@Override
@Nullable
public CodeBlock generateCode(Object value, ResolvableType type) {
if (value instanceof BeanReference beanReference) {
if (value instanceof RuntimeBeanReference runtimeBeanReference
&& runtimeBeanReference.getBeanType() != null) {
return CodeBlock.of("new $T($T.class)", RuntimeBeanReference.class,
runtimeBeanReference.getBeanType());
}
else if (value instanceof BeanReference beanReference) {
return CodeBlock.of("new $T($S)", RuntimeBeanReference.class,
beanReference.getBeanName());
}