From 83e8bfedb255f8a7a881fd21c78aabd50eda9935 Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Tue, 10 Nov 2015 12:13:15 -0800 Subject: [PATCH 1/2] 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 6137dc1253b..a8a246255fb 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 bb7cc67e01e..9d68ec43d9b 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 e030087406b..4dabd469ba7 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 ae421b3c6fa..bbc47c21bfa 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; From c87370085bd5fc328021b6d83fa46385c21519aa Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Tue, 10 Nov 2015 12:15:27 -0800 Subject: [PATCH 2/2] Polish --- spring-boot-docs/src/main/asciidoc/deployment.adoc | 14 +++++++------- ...nfigurationXmlConventionConfigurationTests.java | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/spring-boot-docs/src/main/asciidoc/deployment.adoc b/spring-boot-docs/src/main/asciidoc/deployment.adoc index 3a95d1e00bc..ac624980e40 100644 --- a/spring-boot-docs/src/main/asciidoc/deployment.adoc +++ b/spring-boot-docs/src/main/asciidoc/deployment.adoc @@ -22,7 +22,7 @@ _cloud's_ notion of a running process. Two popular cloud providers, Heroku and Cloud Foundry, employ a "`buildpack`" approach. The buildpack wraps your deployed code in whatever is needed to _start_ your -application: it might be a JDK and a call to `java`, it might be an embedded webserver, +application: it might be a JDK and a call to `java`, it might be an embedded web server, or it might be a full-fledged application server. A buildpack is pluggable, but ideally you should be able to get by with as few customizations to it as possible. This reduces the footprint of functionality that is not under your control. It minimizes @@ -232,11 +232,11 @@ Your application should now be up and running on Heroku. [[cloud-deployment-openshift]] -=== Openshift -https://www.openshift.com/[Openshift] is the RedHat public (and enterprise) PaaS solution. +=== OpenShift +https://www.openshift.com/[OpenShift] is the RedHat public (and enterprise) PaaS solution. Like Heroku, it works by running scripts triggered by git commits, so you can script the launching of a Spring Boot application in pretty much any way you like as long as the -Java runtime is available (which is a standard feature you can ask for at Openshift). +Java runtime is available (which is a standard feature you can ask for at OpenShift). To do this you can use the https://www.openshift.com/developers/do-it-yourself[DIY Cartridge] and hooks in your repository under `.openshift/action_scripts`: @@ -289,7 +289,7 @@ in your `application.properties`, e.g. ---- There's a blog on https://www.openshift.com/blogs/run-gradle-builds-on-openshift[running -Gradle in Openshift] on their website that will get you started with a gradle build to +Gradle in OpenShift] on their website that will get you started with a gradle build to run the app. @@ -299,7 +299,7 @@ run the app. https://boxfuse.com/[Boxfuse] works by turning your Spring Boot executable jar or war into a minimal VM image that can be deployed unchanged either on VirtualBox or on AWS. Boxfuse comes with deep integration for Spring Boot and will use the information from your -Spring Boot configuration file to automatically configure ports and healthcheck URLs. +Spring Boot configuration file to automatically configure ports and health check URLs. Boxfuse leverages this information both for the images it produces as well as for all the resources it provisions (instances, security groups, elastic load balancers, etc). @@ -581,7 +581,7 @@ your Spring Boot application. [[deployment-whats-next]] == What to read next Check out the http://www.cloudfoundry.com/[Cloud Foundry], -https://www.heroku.com/[Heroku], https://www.openshift.com[Openshift] and +https://www.heroku.com/[Heroku], https://www.openshift.com[OpenShift] and https://boxfuse.com[Boxfuse] web sites for more information about the kinds of features that a PaaS can offer. These are just four of the most popular Java PaaS providers, since Spring Boot is so amenable to cloud-based deployment you're free to consider other diff --git a/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationConfigurationXmlConventionConfigurationTests.java b/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationConfigurationXmlConventionConfigurationTests.java index 78ff8827636..1173773943a 100644 --- a/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationConfigurationXmlConventionConfigurationTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/test/SpringApplicationConfigurationXmlConventionConfigurationTests.java @@ -38,7 +38,7 @@ public class SpringApplicationConfigurationXmlConventionConfigurationTests { private String foo; @Test - public void groovyConfigLoaded() { + public void xmlConfigLoaded() { assertThat(this.foo, equalTo("World")); }