|
|
@ -65,6 +65,7 @@ import org.springframework.core.BridgeMethodResolver; |
|
|
|
import org.springframework.core.MethodParameter; |
|
|
|
import org.springframework.core.MethodParameter; |
|
|
|
import org.springframework.core.Ordered; |
|
|
|
import org.springframework.core.Ordered; |
|
|
|
import org.springframework.core.annotation.AnnotationUtils; |
|
|
|
import org.springframework.core.annotation.AnnotationUtils; |
|
|
|
|
|
|
|
import org.springframework.core.annotation.MergedAnnotations; |
|
|
|
import org.springframework.jndi.support.SimpleJndiBeanFactory; |
|
|
|
import org.springframework.jndi.support.SimpleJndiBeanFactory; |
|
|
|
import org.springframework.lang.Nullable; |
|
|
|
import org.springframework.lang.Nullable; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
import org.springframework.util.Assert; |
|
|
@ -379,19 +380,20 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean |
|
|
|
final List<InjectionMetadata.InjectedElement> currElements = new ArrayList<>(); |
|
|
|
final List<InjectionMetadata.InjectedElement> currElements = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
ReflectionUtils.doWithLocalFields(targetClass, field -> { |
|
|
|
ReflectionUtils.doWithLocalFields(targetClass, field -> { |
|
|
|
if (webServiceRefClass != null && field.isAnnotationPresent(webServiceRefClass)) { |
|
|
|
MergedAnnotations annotations = MergedAnnotations.from(field); |
|
|
|
|
|
|
|
if (webServiceRefClass != null && annotations.isDirectlyPresent(webServiceRefClass)) { |
|
|
|
if (Modifier.isStatic(field.getModifiers())) { |
|
|
|
if (Modifier.isStatic(field.getModifiers())) { |
|
|
|
throw new IllegalStateException("@WebServiceRef annotation is not supported on static fields"); |
|
|
|
throw new IllegalStateException("@WebServiceRef annotation is not supported on static fields"); |
|
|
|
} |
|
|
|
} |
|
|
|
currElements.add(new WebServiceRefElement(field, field, null)); |
|
|
|
currElements.add(new WebServiceRefElement(field, field, null)); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (ejbRefClass != null && field.isAnnotationPresent(ejbRefClass)) { |
|
|
|
else if (ejbRefClass != null && annotations.isDirectlyPresent(ejbRefClass)) { |
|
|
|
if (Modifier.isStatic(field.getModifiers())) { |
|
|
|
if (Modifier.isStatic(field.getModifiers())) { |
|
|
|
throw new IllegalStateException("@EJB annotation is not supported on static fields"); |
|
|
|
throw new IllegalStateException("@EJB annotation is not supported on static fields"); |
|
|
|
} |
|
|
|
} |
|
|
|
currElements.add(new EjbRefElement(field, field, null)); |
|
|
|
currElements.add(new EjbRefElement(field, field, null)); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (field.isAnnotationPresent(Resource.class)) { |
|
|
|
else if (annotations.isDirectlyPresent(Resource.class)) { |
|
|
|
if (Modifier.isStatic(field.getModifiers())) { |
|
|
|
if (Modifier.isStatic(field.getModifiers())) { |
|
|
|
throw new IllegalStateException("@Resource annotation is not supported on static fields"); |
|
|
|
throw new IllegalStateException("@Resource annotation is not supported on static fields"); |
|
|
|
} |
|
|
|
} |
|
|
@ -407,7 +409,8 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (method.equals(ClassUtils.getMostSpecificMethod(method, clazz))) { |
|
|
|
if (method.equals(ClassUtils.getMostSpecificMethod(method, clazz))) { |
|
|
|
if (webServiceRefClass != null && bridgedMethod.isAnnotationPresent(webServiceRefClass)) { |
|
|
|
MergedAnnotations annotations = MergedAnnotations.from(bridgedMethod); |
|
|
|
|
|
|
|
if (webServiceRefClass != null && annotations.isDirectlyPresent(webServiceRefClass)) { |
|
|
|
if (Modifier.isStatic(method.getModifiers())) { |
|
|
|
if (Modifier.isStatic(method.getModifiers())) { |
|
|
|
throw new IllegalStateException("@WebServiceRef annotation is not supported on static methods"); |
|
|
|
throw new IllegalStateException("@WebServiceRef annotation is not supported on static methods"); |
|
|
|
} |
|
|
|
} |
|
|
@ -417,7 +420,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean |
|
|
|
PropertyDescriptor pd = BeanUtils.findPropertyForMethod(bridgedMethod, clazz); |
|
|
|
PropertyDescriptor pd = BeanUtils.findPropertyForMethod(bridgedMethod, clazz); |
|
|
|
currElements.add(new WebServiceRefElement(method, bridgedMethod, pd)); |
|
|
|
currElements.add(new WebServiceRefElement(method, bridgedMethod, pd)); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (ejbRefClass != null && bridgedMethod.isAnnotationPresent(ejbRefClass)) { |
|
|
|
else if (ejbRefClass != null && annotations.isDirectlyPresent(ejbRefClass)) { |
|
|
|
if (Modifier.isStatic(method.getModifiers())) { |
|
|
|
if (Modifier.isStatic(method.getModifiers())) { |
|
|
|
throw new IllegalStateException("@EJB annotation is not supported on static methods"); |
|
|
|
throw new IllegalStateException("@EJB annotation is not supported on static methods"); |
|
|
|
} |
|
|
|
} |
|
|
@ -427,7 +430,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean |
|
|
|
PropertyDescriptor pd = BeanUtils.findPropertyForMethod(bridgedMethod, clazz); |
|
|
|
PropertyDescriptor pd = BeanUtils.findPropertyForMethod(bridgedMethod, clazz); |
|
|
|
currElements.add(new EjbRefElement(method, bridgedMethod, pd)); |
|
|
|
currElements.add(new EjbRefElement(method, bridgedMethod, pd)); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (bridgedMethod.isAnnotationPresent(Resource.class)) { |
|
|
|
else if (annotations.isDirectlyPresent(Resource.class)) { |
|
|
|
if (Modifier.isStatic(method.getModifiers())) { |
|
|
|
if (Modifier.isStatic(method.getModifiers())) { |
|
|
|
throw new IllegalStateException("@Resource annotation is not supported on static methods"); |
|
|
|
throw new IllegalStateException("@Resource annotation is not supported on static methods"); |
|
|
|
} |
|
|
|
} |
|
|
|