Merge branch '6.0.x'
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.beans.factory.aot;
|
||||
|
||||
import java.lang.reflect.GenericArrayType;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.lang.model.element.Modifier;
|
||||
@@ -30,9 +32,11 @@ import org.springframework.aot.hint.MemberCategory;
|
||||
import org.springframework.aot.hint.ReflectionHints;
|
||||
import org.springframework.aot.hint.RuntimeHints;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.core.ResolvableType;
|
||||
import org.springframework.javapoet.ClassName;
|
||||
import org.springframework.javapoet.CodeBlock;
|
||||
import org.springframework.javapoet.MethodSpec;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
/**
|
||||
* AOT contribution from a {@link BeanRegistrationsAotProcessor} used to
|
||||
@@ -118,6 +122,17 @@ class BeanRegistrationsAotContribution
|
||||
if (beanClass.isRecord()) {
|
||||
hints.registerType(beanClass, MemberCategory.INVOKE_DECLARED_METHODS);
|
||||
}
|
||||
// Workaround for https://github.com/oracle/graal/issues/6529
|
||||
ReflectionUtils.doWithMethods(beanClass, method -> {
|
||||
for (Type type : method.getGenericParameterTypes()) {
|
||||
if (type instanceof GenericArrayType) {
|
||||
Class<?> clazz = ResolvableType.forType(type).resolve();
|
||||
if (clazz != null) {
|
||||
hints.registerType(clazz);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user