Support for Common Annotations 1.1 Resource.lookup() attribute
Issue: SPR-13941
This commit is contained in:
parent
268ebd7e89
commit
b79e8a5cbc
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -140,6 +140,9 @@ import org.springframework.util.StringUtils;
|
|||
public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBeanPostProcessor
|
||||
implements InstantiationAwareBeanPostProcessor, BeanFactoryAware, Serializable {
|
||||
|
||||
// Common Annotations 1.1 Resource.lookup() available? Not present on JDK 6...
|
||||
private static final Method lookupAttribute = ClassUtils.getMethodIfAvailable(Resource.class, "lookup");
|
||||
|
||||
private static Class<? extends Annotation> webServiceRefClass = null;
|
||||
|
||||
private static Class<? extends Annotation> ejbRefClass = null;
|
||||
|
@ -604,7 +607,9 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
|
|||
}
|
||||
this.name = resourceName;
|
||||
this.lookupType = resourceType;
|
||||
this.mappedName = resource.mappedName();
|
||||
String lookupValue = (lookupAttribute != null ?
|
||||
(String) ReflectionUtils.invokeMethod(lookupAttribute, resource) : null);
|
||||
this.mappedName = (StringUtils.hasLength(lookupValue) ? lookupValue : resource.mappedName());
|
||||
Lazy lazy = ae.getAnnotation(Lazy.class);
|
||||
this.lazyLookup = (lazy != null && lazy.value());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue