javax.annotation.Priority alternative to @Order

This commit rationalizes the use of @Order so that the standard
@Priority annotation can be used instead. The handling of both
annotations are now defined in OrderUtils.

This also updates the link to the JavaEE API so that we refer to
JavaEE7 instead of JavaEE6.

Issue: SPR-11639
This commit is contained in:
Stephane Nicoll
2014-04-01 14:30:47 +02:00
parent 5fe8f52c02
commit dcf5f4a6a3
12 changed files with 211 additions and 61 deletions

View File

@@ -60,6 +60,7 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.config.DependencyDescriptor;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.core.annotation.OrderUtils;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.ObjectUtils;
@@ -1156,12 +1157,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
* @return the priority assigned to that bean or {@code null} if none is set
*/
protected Integer getPriority(Object beanInstance) {
for (Annotation annotation : beanInstance.getClass().getAnnotations()) {
if ("javax.annotation.Priority".equals(annotation.annotationType().getName())) {
return (Integer) AnnotationUtils.getValue(annotation);
}
}
return null;
return OrderUtils.getPriorityValue(beanInstance.getClass());
}
/**