diff --git a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationAwareOrderComparator.java b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationAwareOrderComparator.java index 13a50b910dc85c2d6eec5000fe0815d86b896f4d..17f403029a75da25c17b9ae1ddcaffc09125ae4d 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationAwareOrderComparator.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationAwareOrderComparator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2012 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. @@ -27,12 +27,15 @@ import org.springframework.core.Ordered; * annotation value (if any). * * @author Juergen Hoeller + * @author Oliver Gierke * @since 2.0.1 * @see org.springframework.core.Ordered * @see Order */ public class AnnotationAwareOrderComparator extends OrderComparator { + public static AnnotationAwareOrderComparator INSTANCE = new AnnotationAwareOrderComparator(); + @Override protected int getOrder(Object obj) { if (obj instanceof Ordered) { diff --git a/spring-core/src/test/java/org/springframework/core/annotation/AnnotationAwareOrderComparatorTests.java b/spring-core/src/test/java/org/springframework/core/annotation/AnnotationAwareOrderComparatorTests.java new file mode 100644 index 0000000000000000000000000000000000000000..0a3e64f98e704c9af00f1a6d33650e949228f714 --- /dev/null +++ b/spring-core/src/test/java/org/springframework/core/annotation/AnnotationAwareOrderComparatorTests.java @@ -0,0 +1,34 @@ +/* + * Copyright 2012 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.core.annotation; + +import static org.hamcrest.CoreMatchers.*; +import static org.junit.Assert.*; + +import org.junit.Test; + +/** + * Unit tests for {@link AnnotationAwareOrderComparator}. + * + * @author Oliver Gierke + */ +public class AnnotationAwareOrderComparatorTests { + + @Test + public void instanceVariableIsAnAnnotationAwareOrderComparator() { + assertThat(AnnotationAwareOrderComparator.INSTANCE, is(instanceOf(AnnotationAwareOrderComparator.class))); + } +}