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

@@ -29,7 +29,7 @@ import org.springframework.beans.factory.BeanFactoryUtils;
import org.springframework.context.ApplicationContext;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.core.annotation.Order;
import org.springframework.core.annotation.OrderUtils;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
@@ -215,8 +215,7 @@ public class ControllerAdviceBean implements Ordered {
}
private static int initOrderFromBeanType(Class<?> beanType) {
Order ann = AnnotationUtils.findAnnotation(beanType, Order.class);
return (ann != null ? ann.value() : Ordered.LOWEST_PRECEDENCE);
return OrderUtils.getOrder(beanType, Ordered.LOWEST_PRECEDENCE);
}
private static List<Package> initBasePackagesFromBeanType(Class<?> beanType, ControllerAdvice annotation) {