Consistent Ordered.LOWEST_PRECEDENCE declarations for default order
This commit is contained in:
@@ -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.
|
||||
@@ -23,6 +23,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.BeanInitializationException;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.web.reactive.handler.AbstractUrlHandlerMapping;
|
||||
@@ -56,7 +57,7 @@ public class ResourceHandlerRegistry {
|
||||
|
||||
private final List<ResourceHandlerRegistration> registrations = new ArrayList<>();
|
||||
|
||||
private int order = Integer.MAX_VALUE -1;
|
||||
private int order = Ordered.LOWEST_PRECEDENCE -1;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -49,33 +49,20 @@ public abstract class AbstractHandlerMapping extends ApplicationObjectSupport im
|
||||
private static final WebHandler REQUEST_HANDLED_HANDLER = exchange -> Mono.empty();
|
||||
|
||||
|
||||
private int order = Integer.MAX_VALUE; // default: same as non-Ordered
|
||||
|
||||
private final PathPatternParser patternParser;
|
||||
|
||||
private final UrlBasedCorsConfigurationSource globalCorsConfigSource;
|
||||
|
||||
private CorsProcessor corsProcessor = new DefaultCorsProcessor();
|
||||
|
||||
private int order = Ordered.LOWEST_PRECEDENCE; // default: same as non-Ordered
|
||||
|
||||
|
||||
public AbstractHandlerMapping() {
|
||||
this.patternParser = new PathPatternParser();
|
||||
this.globalCorsConfigSource = new UrlBasedCorsConfigurationSource(this.patternParser);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify the order value for this HandlerMapping bean.
|
||||
* <p>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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut method for setting the same property on the underlying pattern
|
||||
@@ -140,6 +127,20 @@ public abstract class AbstractHandlerMapping extends ApplicationObjectSupport im
|
||||
return this.corsProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify the order value for this HandlerMapping bean.
|
||||
* <p>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;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Mono<Object> getHandler(ServerWebExchange exchange) {
|
||||
|
||||
@@ -41,7 +41,7 @@ public abstract class ViewResolverSupport implements Ordered {
|
||||
|
||||
private Charset defaultCharset = StandardCharsets.UTF_8;
|
||||
|
||||
private int order = Integer.MAX_VALUE;
|
||||
private int order = Ordered.LOWEST_PRECEDENCE;
|
||||
|
||||
|
||||
public ViewResolverSupport() {
|
||||
@@ -84,17 +84,15 @@ public abstract class ViewResolverSupport implements Ordered {
|
||||
return this.defaultCharset;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the order in which this {@link ViewResolver} is evaluated.
|
||||
* Specify the order value for this ViewResolver bean.
|
||||
* <p>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 ViewResolver} is evaluated.
|
||||
*/
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return this.order;
|
||||
|
||||
Reference in New Issue
Block a user