Order EmbeddedServletContainerCustomizers

Add Ordered interface to all EmbeddedServletContainerCustomizers with
a value of 0. Prior to this commit it was difficult for a user to
define a customizer that would be applied before ours, even if they
implemented Ordered or added @Order annotations.

Fixes gh-2123
This commit is contained in:
Phillip Webb
2014-12-22 21:59:00 -08:00
parent ef621c9271
commit 8628adcb74
5 changed files with 35 additions and 5 deletions

View File

@@ -50,6 +50,7 @@ import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomi
import org.springframework.boot.context.embedded.ErrorPage;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.web.servlet.DispatcherServlet;
@@ -79,7 +80,7 @@ public class EndpointWebMvcChildContextConfiguration {
@Configuration
protected static class ServerCustomization implements
EmbeddedServletContainerCustomizer {
EmbeddedServletContainerCustomizer, Ordered {
@Value("${error.path:/error}")
private String errorPath = "/error";
@@ -93,6 +94,11 @@ public class EndpointWebMvcChildContextConfiguration {
private ServerProperties server;
@Override
public int getOrder() {
return 0;
}
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
if (this.managementServerProperties == null) {