Skip to content

Commit 6393e5c

Browse files
committed
Consistent Ordered.LOWEST_PRECEDENCE declarations for default order
1 parent 4da27c2 commit 6393e5c

File tree

13 files changed

+96
-85
lines changed

13 files changed

+96
-85
lines changed

spring-aop/src/main/java/org/springframework/aop/framework/ProxyProcessorSupport.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -52,9 +52,9 @@ public class ProxyProcessorSupport extends ProxyConfig implements Ordered, BeanC
5252

5353

5454
/**
55-
* Set the ordering which will apply to this class's implementation
56-
* of Ordered, used when applying multiple processors.
57-
* <p>Default value is {@code Integer.MAX_VALUE}, meaning that it's non-ordered.
55+
* Set the ordering which will apply to this processor's implementation
56+
* of {@link Ordered}, used when applying multiple processors.
57+
* <p>The default value is {@code Ordered.LOWEST_PRECEDENCE}, meaning non-ordered.
5858
* @param order the ordering value
5959
*/
6060
public void setOrder(int order) {

spring-aop/src/main/java/org/springframework/aop/support/DefaultIntroductionAdvisor.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public class DefaultIntroductionAdvisor implements IntroductionAdvisor, ClassFil
4646

4747
private final Set<Class<?>> interfaces = new LinkedHashSet<>();
4848

49-
private int order = Integer.MAX_VALUE;
49+
private int order = Ordered.LOWEST_PRECEDENCE;
5050

5151

5252
/**
@@ -119,7 +119,6 @@ public void validateInterfaces() throws IllegalArgumentException {
119119
}
120120
}
121121

122-
123122
public void setOrder(int order) {
124123
this.order = order;
125124
}
@@ -129,7 +128,6 @@ public int getOrder() {
129128
return this.order;
130129
}
131130

132-
133131
@Override
134132
public Advice getAdvice() {
135133
return this.advice;

spring-aop/src/main/java/org/springframework/aop/support/StaticMethodMatcherPointcutAdvisor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -36,10 +36,10 @@
3636
public abstract class StaticMethodMatcherPointcutAdvisor extends StaticMethodMatcherPointcut
3737
implements PointcutAdvisor, Ordered, Serializable {
3838

39-
private int order = Integer.MAX_VALUE;
40-
4139
private Advice advice = EMPTY_ADVICE;
4240

41+
private int order = Ordered.LOWEST_PRECEDENCE;
42+
4343

4444
/**
4545
* Create a new StaticMethodMatcherPointcutAdvisor,

spring-webflux/src/main/java/org/springframework/web/reactive/config/ResourceHandlerRegistry.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@
2323
import java.util.Map;
2424

2525
import org.springframework.beans.factory.BeanInitializationException;
26+
import org.springframework.core.Ordered;
2627
import org.springframework.core.io.ResourceLoader;
2728
import org.springframework.lang.Nullable;
2829
import org.springframework.web.reactive.handler.AbstractUrlHandlerMapping;
@@ -56,7 +57,7 @@ public class ResourceHandlerRegistry {
5657

5758
private final List<ResourceHandlerRegistration> registrations = new ArrayList<>();
5859

59-
private int order = Integer.MAX_VALUE -1;
60+
private int order = Ordered.LOWEST_PRECEDENCE -1;
6061

6162

6263
/**

spring-webflux/src/main/java/org/springframework/web/reactive/handler/AbstractHandlerMapping.java

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -49,33 +49,20 @@ public abstract class AbstractHandlerMapping extends ApplicationObjectSupport im
4949
private static final WebHandler REQUEST_HANDLED_HANDLER = exchange -> Mono.empty();
5050

5151

52-
private int order = Integer.MAX_VALUE; // default: same as non-Ordered
53-
5452
private final PathPatternParser patternParser;
5553

5654
private final UrlBasedCorsConfigurationSource globalCorsConfigSource;
5755

5856
private CorsProcessor corsProcessor = new DefaultCorsProcessor();
5957

58+
private int order = Ordered.LOWEST_PRECEDENCE; // default: same as non-Ordered
59+
6060

6161
public AbstractHandlerMapping() {
6262
this.patternParser = new PathPatternParser();
6363
this.globalCorsConfigSource = new UrlBasedCorsConfigurationSource(this.patternParser);
6464
}
6565

66-
/**
67-
* Specify the order value for this HandlerMapping bean.
68-
* <p>Default value is {@code Integer.MAX_VALUE}, meaning that it's non-ordered.
69-
* @see org.springframework.core.Ordered#getOrder()
70-
*/
71-
public final void setOrder(int order) {
72-
this.order = order;
73-
}
74-
75-
@Override
76-
public final int getOrder() {
77-
return this.order;
78-
}
7966

8067
/**
8168
* Shortcut method for setting the same property on the underlying pattern
@@ -140,6 +127,20 @@ public CorsProcessor getCorsProcessor() {
140127
return this.corsProcessor;
141128
}
142129

130+
/**
131+
* Specify the order value for this HandlerMapping bean.
132+
* <p>The default value is {@code Ordered.LOWEST_PRECEDENCE}, meaning non-ordered.
133+
* @see org.springframework.core.Ordered#getOrder()
134+
*/
135+
public void setOrder(int order) {
136+
this.order = order;
137+
}
138+
139+
@Override
140+
public int getOrder() {
141+
return this.order;
142+
}
143+
143144

144145
@Override
145146
public Mono<Object> getHandler(ServerWebExchange exchange) {

spring-webflux/src/main/java/org/springframework/web/reactive/result/view/ViewResolverSupport.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public abstract class ViewResolverSupport implements Ordered {
4141

4242
private Charset defaultCharset = StandardCharsets.UTF_8;
4343

44-
private int order = Integer.MAX_VALUE;
44+
private int order = Ordered.LOWEST_PRECEDENCE;
4545

4646

4747
public ViewResolverSupport() {
@@ -84,17 +84,15 @@ public Charset getDefaultCharset() {
8484
return this.defaultCharset;
8585
}
8686

87-
8887
/**
89-
* Set the order in which this {@link ViewResolver} is evaluated.
88+
* Specify the order value for this ViewResolver bean.
89+
* <p>The default value is {@code Ordered.LOWEST_PRECEDENCE}, meaning non-ordered.
90+
* @see org.springframework.core.Ordered#getOrder()
9091
*/
9192
public void setOrder(int order) {
9293
this.order = order;
9394
}
9495

95-
/**
96-
* Return the order in which this {@link ViewResolver} is evaluated.
97-
*/
9896
@Override
9997
public int getOrder() {
10098
return this.order;

spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistry.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@
2525

2626
import org.springframework.beans.factory.BeanInitializationException;
2727
import org.springframework.context.ApplicationContext;
28+
import org.springframework.core.Ordered;
2829
import org.springframework.lang.Nullable;
2930
import org.springframework.util.Assert;
3031
import org.springframework.web.HttpRequestHandler;
@@ -65,7 +66,7 @@ public class ResourceHandlerRegistry {
6566

6667
private final List<ResourceHandlerRegistration> registrations = new ArrayList<>();
6768

68-
private int order = Integer.MAX_VALUE -1;
69+
private int order = Ordered.LOWEST_PRECEDENCE - 1;
6970

7071

7172
/**

spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMapping.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@
6767
*/
6868
public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport implements HandlerMapping, Ordered {
6969

70-
private int order = Integer.MAX_VALUE; // default: same as non-Ordered
71-
7270
@Nullable
7371
private Object defaultHandler;
7472

@@ -84,20 +82,8 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
8482

8583
private CorsProcessor corsProcessor = new DefaultCorsProcessor();
8684

85+
private int order = Ordered.LOWEST_PRECEDENCE; // default: same as non-Ordered
8786

88-
/**
89-
* Specify the order value for this HandlerMapping bean.
90-
* <p>Default value is {@code Integer.MAX_VALUE}, meaning that it's non-ordered.
91-
* @see org.springframework.core.Ordered#getOrder()
92-
*/
93-
public final void setOrder(int order) {
94-
this.order = order;
95-
}
96-
97-
@Override
98-
public final int getOrder() {
99-
return this.order;
100-
}
10187

10288
/**
10389
* Set the default handler for this handler mapping.
@@ -231,6 +217,20 @@ public CorsProcessor getCorsProcessor() {
231217
return this.corsProcessor;
232218
}
233219

220+
/**
221+
* Specify the order value for this HandlerMapping bean.
222+
* <p>The default value is {@code Ordered.LOWEST_PRECEDENCE}, meaning non-ordered.
223+
* @see org.springframework.core.Ordered#getOrder()
224+
*/
225+
public void setOrder(int order) {
226+
this.order = order;
227+
}
228+
229+
@Override
230+
public int getOrder() {
231+
return this.order;
232+
}
233+
234234

235235
/**
236236
* Initializes the interceptors.

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/AbstractHandlerMethodAdapter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@ public AbstractHandlerMethodAdapter() {
4646

4747
/**
4848
* Specify the order value for this HandlerAdapter bean.
49-
* <p>Default value is {@code Integer.MAX_VALUE}, meaning that it's non-ordered.
49+
* <p>The default value is {@code Ordered.LOWEST_PRECEDENCE}, meaning non-ordered.
5050
* @see org.springframework.core.Ordered#getOrder()
5151
*/
5252
public void setOrder(int order) {

spring-webmvc/src/main/java/org/springframework/web/servlet/view/BeanNameViewResolver.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -54,9 +54,14 @@
5454
*/
5555
public class BeanNameViewResolver extends WebApplicationObjectSupport implements ViewResolver, Ordered {
5656

57-
private int order = Integer.MAX_VALUE; // default: same as non-Ordered
57+
private int order = Ordered.LOWEST_PRECEDENCE; // default: same as non-Ordered
5858

5959

60+
/**
61+
* Specify the order value for this ViewResolver bean.
62+
* <p>The default value is {@code Ordered.LOWEST_PRECEDENCE}, meaning non-ordered.
63+
* @see org.springframework.core.Ordered#getOrder()
64+
*/
6065
public void setOrder(int order) {
6166
this.order = order;
6267
}

0 commit comments

Comments
 (0)