Fix support for target arrays

This commits makes sure that a bean that produces an array can be
processed ahead of time. If the request target type is an array, its
component type is used.

Closes gh-31426
This commit is contained in:
Stéphane Nicoll
2023-10-13 15:33:26 +02:00
parent 85388aa642
commit 607c84f960
3 changed files with 48 additions and 1 deletions

View File

@@ -83,7 +83,7 @@ class DefaultBeanRegistrationCodeFragments implements BeanRegistrationCodeFragme
Assert.state(parent != null, "No parent available for inner bean");
target = parent.getBeanClass();
}
return ClassName.get(target);
return (target.isArray() ? ClassName.get(target.getComponentType()) : ClassName.get(target));
}
private Class<?> extractDeclaringClass(ResolvableType beanType, Executable executable) {