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:
@@ -36,6 +36,7 @@ import org.springframework.beans.testfixture.beans.factory.aot.MockBeanRegistrat
|
||||
import org.springframework.beans.testfixture.beans.factory.aot.MockBeanRegistrationsCode;
|
||||
import org.springframework.beans.testfixture.beans.factory.aot.NumberFactoryBean;
|
||||
import org.springframework.beans.testfixture.beans.factory.aot.SimpleBean;
|
||||
import org.springframework.beans.testfixture.beans.factory.aot.SimpleBeanArrayFactoryBean;
|
||||
import org.springframework.beans.testfixture.beans.factory.aot.SimpleBeanConfiguration;
|
||||
import org.springframework.beans.testfixture.beans.factory.aot.SimpleBeanFactoryBean;
|
||||
import org.springframework.core.ResolvableType;
|
||||
@@ -76,6 +77,13 @@ class DefaultBeanRegistrationCodeFragmentsTests {
|
||||
assertTarget(createInstance(registeredBean).getTarget(registeredBean), SimpleBean.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void getTargetOnConstructorToPublicFactoryBeanProducingArray() {
|
||||
RegisteredBean registeredBean = registerTestBean(SimpleBean[].class,
|
||||
SimpleBeanArrayFactoryBean.class.getDeclaredConstructors()[0]);
|
||||
assertTarget(createInstance(registeredBean).getTarget(registeredBean), SimpleBean.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void getTargetOnConstructorToPublicGenericFactoryBeanExtractTargetFromFactoryBeanType() {
|
||||
ResolvableType beanType = ResolvableType.forClassWithGenerics(
|
||||
|
||||
Reference in New Issue
Block a user