From 83e8bfedb255f8a7a881fd21c78aabd50eda9935 Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Tue, 10 Nov 2015 12:13:15 -0800 Subject: [PATCH] Use Ordered.HIGHEST_PRECEDENCE constants Use Ordered.HIGHEST_PRECEDENCE rather than Integer.MIN_VALUE. Closes gh-4335 --- .../boot/autoconfigure/social/SocialWebAutoConfiguration.java | 3 ++- .../boot/autoconfigure/web/WebMvcAutoConfiguration.java | 2 +- .../boot/context/ContextIdApplicationContextInitializer.java | 2 +- .../web/ServletContextApplicationContextInitializer.java | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/social/SocialWebAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/social/SocialWebAutoConfiguration.java index 6137dc1253..a8a246255f 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/social/SocialWebAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/social/SocialWebAutoConfiguration.java @@ -18,6 +18,7 @@ package org.springframework.boot.autoconfigure.social; import java.util.List; +import org.springframework.core.Ordered; import org.thymeleaf.spring4.SpringTemplateEngine; import org.springframework.beans.factory.annotation.Autowired; @@ -104,7 +105,7 @@ public class SocialWebAutoConfiguration { @ConditionalOnProperty(prefix = "spring.social", name = "auto-connection-views") public BeanNameViewResolver beanNameViewResolver() { BeanNameViewResolver viewResolver = new BeanNameViewResolver(); - viewResolver.setOrder(Integer.MIN_VALUE); + viewResolver.setOrder(Ordered.HIGHEST_PRECEDENCE); return viewResolver; } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java index bb7cc67e01..9d68ec43d9 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java @@ -317,7 +317,7 @@ public class WebMvcAutoConfiguration { @Bean public SimpleUrlHandlerMapping faviconHandlerMapping() { SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping(); - mapping.setOrder(Integer.MIN_VALUE + 1); + mapping.setOrder(Ordered.HIGHEST_PRECEDENCE + 1); mapping.setUrlMap(Collections.singletonMap("**/favicon.ico", faviconRequestHandler())); return mapping; diff --git a/spring-boot/src/main/java/org/springframework/boot/context/ContextIdApplicationContextInitializer.java b/spring-boot/src/main/java/org/springframework/boot/context/ContextIdApplicationContextInitializer.java index e030087406..4dabd469ba 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/ContextIdApplicationContextInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/ContextIdApplicationContextInitializer.java @@ -61,7 +61,7 @@ public class ContextIdApplicationContextInitializer implements private final String name; - private int order = Integer.MAX_VALUE - 10; + private int order = Ordered.LOWEST_PRECEDENCE - 10; public ContextIdApplicationContextInitializer() { this(NAME_PATTERN); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/web/ServletContextApplicationContextInitializer.java b/spring-boot/src/main/java/org/springframework/boot/context/web/ServletContextApplicationContextInitializer.java index ae421b3c6f..bbc47c21bf 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/web/ServletContextApplicationContextInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/web/ServletContextApplicationContextInitializer.java @@ -30,7 +30,7 @@ import org.springframework.web.context.ConfigurableWebApplicationContext; public class ServletContextApplicationContextInitializer implements ApplicationContextInitializer, Ordered { - private int order = Integer.MIN_VALUE; + private int order = Ordered.HIGHEST_PRECEDENCE; private final ServletContext servletContext;