mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-25 08:19:01 +00:00
Merge branch '6.2.x'
# Conflicts: # spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java # spring-core/src/main/java/org/springframework/core/BridgeMethodResolver.java
This commit is contained in:
+7
-9
@@ -20,7 +20,6 @@ import java.beans.PropertyDescriptor;
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.AnnotatedElement;
|
||||
import java.lang.reflect.Member;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -423,7 +422,7 @@ public class PersistenceAnnotationBeanPostProcessor implements InstantiationAwar
|
||||
}
|
||||
|
||||
List<InjectionMetadata.InjectedElement> elements = new ArrayList<>();
|
||||
Class<?> targetClass = clazz;
|
||||
Class<?> targetClass = ClassUtils.getUserClass(clazz);
|
||||
|
||||
do {
|
||||
final List<InjectionMetadata.InjectedElement> currElements = new ArrayList<>();
|
||||
@@ -439,21 +438,20 @@ public class PersistenceAnnotationBeanPostProcessor implements InstantiationAwar
|
||||
});
|
||||
|
||||
ReflectionUtils.doWithLocalMethods(targetClass, method -> {
|
||||
Method bridgedMethod = BridgeMethodResolver.findBridgedMethod(method);
|
||||
if (!BridgeMethodResolver.isVisibilityBridgeMethodPair(method, bridgedMethod)) {
|
||||
if (method.isBridge()) {
|
||||
return;
|
||||
}
|
||||
if ((bridgedMethod.isAnnotationPresent(PersistenceContext.class) ||
|
||||
bridgedMethod.isAnnotationPresent(PersistenceUnit.class)) &&
|
||||
method.equals(ClassUtils.getMostSpecificMethod(method, clazz))) {
|
||||
if ((method.isAnnotationPresent(PersistenceContext.class) ||
|
||||
method.isAnnotationPresent(PersistenceUnit.class)) &&
|
||||
method.equals(BridgeMethodResolver.getMostSpecificMethod(method, clazz))) {
|
||||
if (Modifier.isStatic(method.getModifiers())) {
|
||||
throw new IllegalStateException("Persistence annotations are not supported on static methods");
|
||||
}
|
||||
if (method.getParameterCount() != 1) {
|
||||
throw new IllegalStateException("Persistence annotation requires a single-arg method: " + method);
|
||||
}
|
||||
PropertyDescriptor pd = BeanUtils.findPropertyForMethod(bridgedMethod, clazz);
|
||||
currElements.add(new PersistenceElement(method, bridgedMethod, pd));
|
||||
PropertyDescriptor pd = BeanUtils.findPropertyForMethod(method, clazz);
|
||||
currElements.add(new PersistenceElement(method, method, pd));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user