diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/ProxyProcessorSupport.java b/spring-aop/src/main/java/org/springframework/aop/framework/ProxyProcessorSupport.java index 2c3de88958d..74f3073b93f 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/ProxyProcessorSupport.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/ProxyProcessorSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -50,9 +50,9 @@ public class ProxyProcessorSupport extends ProxyConfig implements Ordered, BeanC /** - * Set the ordering which will apply to this class's implementation - * of Ordered, used when applying multiple processors. - *

Default value is {@code Integer.MAX_VALUE}, meaning that it's non-ordered. + * Set the ordering which will apply to this processor's implementation + * of {@link Ordered}, used when applying multiple processors. + *

The default value is {@code Ordered.LOWEST_PRECEDENCE}, meaning non-ordered. * @param order the ordering value */ public void setOrder(int order) { diff --git a/spring-aop/src/main/java/org/springframework/aop/support/DefaultIntroductionAdvisor.java b/spring-aop/src/main/java/org/springframework/aop/support/DefaultIntroductionAdvisor.java index 8219737a222..17b167010fa 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/DefaultIntroductionAdvisor.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/DefaultIntroductionAdvisor.java @@ -45,7 +45,7 @@ public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFil private final Set> interfaces = new LinkedHashSet>(); - private int order = Integer.MAX_VALUE; + private int order = Ordered.LOWEST_PRECEDENCE; /** @@ -118,7 +118,6 @@ public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFil } } - public void setOrder(int order) { this.order = order; } @@ -128,7 +127,6 @@ public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFil return this.order; } - @Override public Advice getAdvice() { return this.advice; diff --git a/spring-aop/src/main/java/org/springframework/aop/support/StaticMethodMatcherPointcutAdvisor.java b/spring-aop/src/main/java/org/springframework/aop/support/StaticMethodMatcherPointcutAdvisor.java index 9dbe10dbf4f..3ba109a1ac4 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/StaticMethodMatcherPointcutAdvisor.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/StaticMethodMatcherPointcutAdvisor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2018 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. @@ -36,10 +36,10 @@ import org.springframework.util.Assert; public abstract class StaticMethodMatcherPointcutAdvisor extends StaticMethodMatcherPointcut implements PointcutAdvisor, Ordered, Serializable { - private int order = Integer.MAX_VALUE; - private Advice advice; + private int order = Integer.MAX_VALUE; + /** * Create a new StaticMethodMatcherPointcutAdvisor, diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistry.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistry.java index 8b276218452..9617cdedb7d 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistry.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -25,6 +25,7 @@ import javax.servlet.ServletContext; import org.springframework.beans.factory.BeanInitializationException; import org.springframework.context.ApplicationContext; +import org.springframework.core.Ordered; import org.springframework.util.Assert; import org.springframework.web.HttpRequestHandler; import org.springframework.web.accept.ContentNegotiationManager; @@ -62,7 +63,7 @@ public class ResourceHandlerRegistry { private final List registrations = new ArrayList(); - private int order = Integer.MAX_VALUE -1; + private int order = Ordered.LOWEST_PRECEDENCE - 1; /** diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMapping.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMapping.java index 0ecab435b43..13012abb03c 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMapping.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMapping.java @@ -66,8 +66,6 @@ import org.springframework.web.util.UrlPathHelper; */ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport implements HandlerMapping, Ordered { - private int order = Integer.MAX_VALUE; // default: same as non-Ordered - private Object defaultHandler; private UrlPathHelper urlPathHelper = new UrlPathHelper(); @@ -82,20 +80,8 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport private CorsProcessor corsProcessor = new DefaultCorsProcessor(); + private int order = Ordered.LOWEST_PRECEDENCE; // default: same as non-Ordered - /** - * Specify the order value for this HandlerMapping bean. - *

Default value is {@code Integer.MAX_VALUE}, meaning that it's non-ordered. - * @see org.springframework.core.Ordered#getOrder() - */ - public final void setOrder(int order) { - this.order = order; - } - - @Override - public final int getOrder() { - return this.order; - } /** * Set the default handler for this handler mapping. @@ -235,6 +221,20 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport return this.corsProcessor; } + /** + * Specify the order value for this HandlerMapping bean. + *

The default value is {@code Ordered.LOWEST_PRECEDENCE}, meaning non-ordered. + * @see org.springframework.core.Ordered#getOrder() + */ + public void setOrder(int order) { + this.order = order; + } + + @Override + public int getOrder() { + return this.order; + } + /** * Initializes the interceptors. diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/AbstractHandlerMethodAdapter.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/AbstractHandlerMethodAdapter.java index 803b595d4be..2a7c47a6a9f 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/AbstractHandlerMethodAdapter.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/AbstractHandlerMethodAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2018 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. @@ -45,7 +45,7 @@ public abstract class AbstractHandlerMethodAdapter extends WebContentGenerator i /** * Specify the order value for this HandlerAdapter bean. - *

Default value is {@code Integer.MAX_VALUE}, meaning that it's non-ordered. + *

The default value is {@code Ordered.LOWEST_PRECEDENCE}, meaning non-ordered. * @see org.springframework.core.Ordered#getOrder() */ public void setOrder(int order) { diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/BeanNameViewResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/BeanNameViewResolver.java index 37880798029..8bc7f71c2ee 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/BeanNameViewResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/BeanNameViewResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2018 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. @@ -53,9 +53,14 @@ import org.springframework.web.servlet.ViewResolver; */ public class BeanNameViewResolver extends WebApplicationObjectSupport implements ViewResolver, Ordered { - private int order = Integer.MAX_VALUE; // default: same as non-Ordered + private int order = Ordered.LOWEST_PRECEDENCE; // default: same as non-Ordered + /** + * Specify the order value for this ViewResolver bean. + *

The default value is {@code Ordered.LOWEST_PRECEDENCE}, meaning non-ordered. + * @see org.springframework.core.Ordered#getOrder() + */ public void setOrder(int order) { this.order = order; } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/ResourceBundleViewResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/ResourceBundleViewResolver.java index 78731a71b5b..8e8313f34d8 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/ResourceBundleViewResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/ResourceBundleViewResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2018 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. @@ -63,11 +63,9 @@ public class ResourceBundleViewResolver extends AbstractCachingViewResolver implements Ordered, InitializingBean, DisposableBean { /** The default basename if no other basename is supplied. */ - public final static String DEFAULT_BASENAME = "views"; + public static final String DEFAULT_BASENAME = "views"; - private int order = Integer.MAX_VALUE; // default: same as non-Ordered - private String[] basenames = new String[] {DEFAULT_BASENAME}; private ClassLoader bundleClassLoader = Thread.currentThread().getContextClassLoader(); @@ -76,6 +74,8 @@ public class ResourceBundleViewResolver extends AbstractCachingViewResolver private Locale[] localesToInitialize; + private int order = Ordered.LOWEST_PRECEDENCE; // default: same as non-Ordered + /* Locale -> BeanFactory */ private final Map localeCache = new HashMap(); @@ -85,15 +85,6 @@ public class ResourceBundleViewResolver extends AbstractCachingViewResolver new HashMap, ConfigurableApplicationContext>(); - public void setOrder(int order) { - this.order = order; - } - - @Override - public int getOrder() { - return this.order; - } - /** * Set a single basename, following {@link java.util.ResourceBundle} conventions. * The default is "views". @@ -175,6 +166,20 @@ public class ResourceBundleViewResolver extends AbstractCachingViewResolver this.localesToInitialize = localesToInitialize; } + /** + * Specify the order value for this ViewResolver bean. + *

The default value is {@code Ordered.LOWEST_PRECEDENCE}, meaning non-ordered. + * @see org.springframework.core.Ordered#getOrder() + */ + public void setOrder(int order) { + this.order = order; + } + + @Override + public int getOrder() { + return this.order; + } + /** * Eagerly initialize Locales if necessary. * @see #setLocalesToInitialize diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/UrlBasedViewResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/UrlBasedViewResolver.java index 9b09f8a9656..ef7cd69e266 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/UrlBasedViewResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/UrlBasedViewResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 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. @@ -128,7 +128,7 @@ public class UrlBasedViewResolver extends AbstractCachingViewResolver implements private String[] viewNames; - private int order = Integer.MAX_VALUE; + private int order = Ordered.LOWEST_PRECEDENCE; /** @@ -407,17 +407,14 @@ public class UrlBasedViewResolver extends AbstractCachingViewResolver implements } /** - * Set the order in which this {@link org.springframework.web.servlet.ViewResolver} - * is evaluated. + * Specify the order value for this ViewResolver bean. + *

The default value is {@code Ordered.LOWEST_PRECEDENCE}, meaning non-ordered. + * @see org.springframework.core.Ordered#getOrder() */ public void setOrder(int order) { this.order = order; } - /** - * Return the order in which this {@link org.springframework.web.servlet.ViewResolver} - * is evaluated. - */ @Override public int getOrder() { return this.order; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/XmlViewResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/XmlViewResolver.java index 2dff2547930..9b4eb3ddb58 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/XmlViewResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/XmlViewResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2018 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. @@ -57,24 +57,15 @@ public class XmlViewResolver extends AbstractCachingViewResolver implements Ordered, InitializingBean, DisposableBean { /** Default if no other location is supplied */ - public final static String DEFAULT_LOCATION = "/WEB-INF/views.xml"; + public static final String DEFAULT_LOCATION = "/WEB-INF/views.xml"; - private int order = Integer.MAX_VALUE; // default: same as non-Ordered - private Resource location; private ConfigurableApplicationContext cachedFactory; + private int order = Ordered.LOWEST_PRECEDENCE; // default: same as non-Ordered - public void setOrder(int order) { - this.order = order; - } - - @Override - public int getOrder() { - return this.order; - } /** * Set the location of the XML file that defines the view beans. @@ -85,6 +76,20 @@ public class XmlViewResolver extends AbstractCachingViewResolver this.location = location; } + /** + * Specify the order value for this ViewResolver bean. + *

The default value is {@code Ordered.LOWEST_PRECEDENCE}, meaning non-ordered. + * @see org.springframework.core.Ordered#getOrder() + */ + public void setOrder(int order) { + this.order = order; + } + + @Override + public int getOrder() { + return this.order; + } + /** * Pre-initialize the factory from the XML file. * Only effective if caching is enabled.