Skip to content

Commit 7bc3e3b

Browse files
committed
Fixed handling of @resource's shareable value
Issue: SPR-10931
1 parent 783871a commit 7bc3e3b

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -473,11 +473,8 @@ protected abstract class LookupElement extends InjectionMetadata.InjectedElement
473473

474474
public LookupElement(Member member, PropertyDescriptor pd) {
475475
super(member, pd);
476-
initAnnotation((AnnotatedElement) member);
477476
}
478477

479-
protected abstract void initAnnotation(AnnotatedElement ae);
480-
481478
/**
482479
* Return the resource name for the lookup.
483480
*/
@@ -512,14 +509,11 @@ public final DependencyDescriptor getDependencyDescriptor() {
512509
*/
513510
private class ResourceElement extends LookupElement {
514511

515-
protected boolean shareable = true;
512+
protected final boolean shareable;
516513

517514
public ResourceElement(Member member, PropertyDescriptor pd) {
518515
super(member, pd);
519-
}
520-
521-
@Override
522-
protected void initAnnotation(AnnotatedElement ae) {
516+
AnnotatedElement ae = (AnnotatedElement) member;
523517
Resource resource = ae.getAnnotation(Resource.class);
524518
String resourceName = resource.name();
525519
Class<?> resourceType = resource.type();
@@ -559,16 +553,13 @@ protected Object getResourceToInject(Object target, String requestingBeanName) {
559553
*/
560554
private class WebServiceRefElement extends LookupElement {
561555

562-
private Class<?> elementType;
556+
private final Class<?> elementType;
563557

564-
private String wsdlLocation;
558+
private final String wsdlLocation;
565559

566560
public WebServiceRefElement(Member member, PropertyDescriptor pd) {
567561
super(member, pd);
568-
}
569-
570-
@Override
571-
protected void initAnnotation(AnnotatedElement ae) {
562+
AnnotatedElement ae = (AnnotatedElement) member;
572563
WebServiceRef resource = ae.getAnnotation(WebServiceRef.class);
573564
String resourceName = resource.name();
574565
Class<?> resourceType = resource.type();
@@ -648,14 +639,11 @@ protected Object getResourceToInject(Object target, String requestingBeanName) {
648639
*/
649640
private class EjbRefElement extends LookupElement {
650641

651-
private String beanName;
642+
private final String beanName;
652643

653644
public EjbRefElement(Member member, PropertyDescriptor pd) {
654645
super(member, pd);
655-
}
656-
657-
@Override
658-
protected void initAnnotation(AnnotatedElement ae) {
646+
AnnotatedElement ae = (AnnotatedElement) member;
659647
EJB resource = ae.getAnnotation(EJB.class);
660648
String resourceBeanName = resource.beanName();
661649
String resourceName = resource.name();

0 commit comments

Comments
 (0)