Remove auto-configuration for ServerProperties
This commit removes `ServerProperties` and `ManagementServerProperties` auto-configurations. Those properties objects are now created using `@EnableConfigurationProperties` only. Closes gh-8108
This commit is contained in:
@@ -78,6 +78,7 @@ public class H2ConsoleAutoConfiguration {
|
||||
@Configuration
|
||||
@ConditionalOnClass(WebSecurityConfigurerAdapter.class)
|
||||
@ConditionalOnBean(ObjectPostProcessor.class)
|
||||
@EnableConfigurationProperties(SecurityProperties.class)
|
||||
@ConditionalOnProperty(prefix = "security.basic", name = "enabled", matchIfMissing = true)
|
||||
static class H2ConsoleSecurityConfiguration {
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
|
||||
@Configuration
|
||||
@ConditionalOnClass({ AuthenticationManager.class,
|
||||
GlobalAuthenticationConfigurerAdapter.class })
|
||||
@EnableConfigurationProperties
|
||||
@EnableConfigurationProperties(SecurityProperties.class)
|
||||
@Import({ SpringBootWebSecurityConfiguration.class,
|
||||
AuthenticationManagerConfiguration.class,
|
||||
BootGlobalAuthenticationConfiguration.class, SecurityDataConfiguration.class })
|
||||
@@ -60,10 +60,4 @@ public class SecurityAutoConfiguration {
|
||||
return new DefaultAuthenticationEventPublisher(publisher);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public SecurityProperties securityProperties() {
|
||||
return new SecurityProperties();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean;
|
||||
@@ -49,7 +48,7 @@ import org.springframework.security.web.context.AbstractSecurityWebApplicationIn
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnWebApplication
|
||||
@EnableConfigurationProperties
|
||||
@EnableConfigurationProperties(SecurityProperties.class)
|
||||
@ConditionalOnClass({ AbstractSecurityWebApplicationInitializer.class,
|
||||
SessionCreationPolicy.class })
|
||||
@AutoConfigureAfter(SecurityAutoConfiguration.class)
|
||||
@@ -68,12 +67,6 @@ public class SecurityFilterAutoConfiguration {
|
||||
return registration;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public SecurityProperties securityProperties() {
|
||||
return new SecurityProperties();
|
||||
}
|
||||
|
||||
private EnumSet<DispatcherType> getDispatcherTypes(
|
||||
SecurityProperties securityProperties) {
|
||||
if (securityProperties.getFilterDispatcherTypes() == null) {
|
||||
|
||||
@@ -85,7 +85,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
@Configuration
|
||||
@EnableConfigurationProperties
|
||||
@EnableConfigurationProperties(ServerProperties.class)
|
||||
@ConditionalOnClass({ EnableWebSecurity.class, AuthenticationEntryPoint.class })
|
||||
@ConditionalOnMissingBean(WebSecurityConfiguration.class)
|
||||
@ConditionalOnWebApplication
|
||||
|
||||
@@ -65,6 +65,7 @@ import org.springframework.web.servlet.DispatcherServlet;
|
||||
@ConditionalOnWebApplication
|
||||
@ConditionalOnClass(DispatcherServlet.class)
|
||||
@AutoConfigureAfter(EmbeddedServletContainerAutoConfiguration.class)
|
||||
@EnableConfigurationProperties(ServerProperties.class)
|
||||
public class DispatcherServletAutoConfiguration {
|
||||
|
||||
/*
|
||||
|
||||
@@ -43,6 +43,7 @@ import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory
|
||||
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory;
|
||||
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
|
||||
import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.boot.web.servlet.ErrorPageRegistrarBeanPostProcessor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -62,6 +63,7 @@ import org.springframework.util.ObjectUtils;
|
||||
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE)
|
||||
@Configuration
|
||||
@ConditionalOnWebApplication
|
||||
@EnableConfigurationProperties(ServerProperties.class)
|
||||
@Import(BeanPostProcessorsRegistrar.class)
|
||||
public class EmbeddedServletContainerAutoConfiguration {
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ import org.springframework.web.util.HtmlUtils;
|
||||
@ConditionalOnClass({ Servlet.class, DispatcherServlet.class })
|
||||
// Load before the main WebMvcAutoConfiguration so that the error View is available
|
||||
@AutoConfigureBefore(WebMvcAutoConfiguration.class)
|
||||
@EnableConfigurationProperties(ResourceProperties.class)
|
||||
@EnableConfigurationProperties({ ServerProperties.class, ResourceProperties.class })
|
||||
public class ErrorMvcAutoConfiguration {
|
||||
|
||||
private final ServerProperties serverProperties;
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2015 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.web;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.boot.autoconfigure.condition.SearchStrategy;
|
||||
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
|
||||
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} that configures the
|
||||
* {@link ConfigurableEmbeddedServletContainer} from a {@link ServerProperties} bean.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
@Configuration
|
||||
@EnableConfigurationProperties
|
||||
@ConditionalOnWebApplication
|
||||
public class ServerPropertiesAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(search = SearchStrategy.CURRENT)
|
||||
public ServerProperties serverProperties() {
|
||||
return new ServerProperties();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DuplicateServerPropertiesDetector duplicateServerPropertiesDetector() {
|
||||
return new DuplicateServerPropertiesDetector();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link EmbeddedServletContainerCustomizer} that ensures there is exactly one
|
||||
* {@link ServerProperties} bean in the application context.
|
||||
*/
|
||||
private static class DuplicateServerPropertiesDetector implements
|
||||
EmbeddedServletContainerCustomizer, Ordered, ApplicationContextAware {
|
||||
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext)
|
||||
throws BeansException {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customize(ConfigurableEmbeddedServletContainer container) {
|
||||
// ServerProperties handles customization, this just checks we only have
|
||||
// a single bean
|
||||
String[] serverPropertiesBeans = this.applicationContext
|
||||
.getBeanNamesForType(ServerProperties.class);
|
||||
Assert.state(serverPropertiesBeans.length == 1,
|
||||
"Multiple ServerProperties beans registered " + StringUtils
|
||||
.arrayToCommaDelimitedString(serverPropertiesBeans));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -107,7 +107,6 @@ org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.web.HttpEncodingAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.web.MultipartAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.web.WebClientAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.websocket.WebSocketAutoConfiguration,\
|
||||
|
||||
@@ -21,7 +21,6 @@ import org.junit.Test;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
@@ -49,8 +48,7 @@ public class AutoConfigurationReproTests {
|
||||
public void doesNotEarlyInitializeFactoryBeans() throws Exception {
|
||||
SpringApplication application = new SpringApplication(EarlyInitConfig.class,
|
||||
PropertySourcesPlaceholderConfigurer.class,
|
||||
EmbeddedServletContainerAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class);
|
||||
EmbeddedServletContainerAutoConfiguration.class);
|
||||
this.context = application.run("--server.port=0");
|
||||
String bean = (String) this.context.getBean("earlyInit");
|
||||
assertThat(bean).isEqualTo("bucket");
|
||||
|
||||
@@ -37,7 +37,6 @@ import org.springframework.boot.admin.SpringApplicationAdminMXBeanRegistrar;
|
||||
import org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.context.embedded.EmbeddedWebApplicationContext;
|
||||
import org.springframework.boot.test.util.EnvironmentTestUtils;
|
||||
@@ -121,7 +120,6 @@ public class SpringApplicationAdminJmxAutoConfigurationTests {
|
||||
public void registerWithSimpleWebApp() throws Exception {
|
||||
this.context = new SpringApplicationBuilder()
|
||||
.sources(EmbeddedServletContainerAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class,
|
||||
JmxAutoConfiguration.class,
|
||||
SpringApplicationAdminJmxAutoConfiguration.class)
|
||||
|
||||
@@ -22,7 +22,6 @@ import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfigurationIntegrationTests.TestConfiguration;
|
||||
import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@@ -82,8 +81,7 @@ public class H2ConsoleAutoConfigurationIntegrationTests {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@Import({ SecurityAutoConfiguration.class, ServerPropertiesAutoConfiguration.class,
|
||||
H2ConsoleAutoConfiguration.class })
|
||||
@Import({ SecurityAutoConfiguration.class, H2ConsoleAutoConfiguration.class })
|
||||
@Controller
|
||||
static class TestConfiguration {
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
@@ -97,8 +96,7 @@ public class JerseyAutoConfigurationCustomFilterContextPathTests {
|
||||
@Documented
|
||||
@Configuration
|
||||
@Import({ EmbeddedServletContainerAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class, JerseyAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class })
|
||||
JerseyAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class })
|
||||
protected @interface MinimalWebConfiguration {
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
@@ -96,8 +95,7 @@ public class JerseyAutoConfigurationCustomFilterPathTests {
|
||||
@Documented
|
||||
@Configuration
|
||||
@Import({ EmbeddedServletContainerAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class, JerseyAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class })
|
||||
JerseyAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class })
|
||||
protected @interface MinimalWebConfiguration {
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
@@ -75,8 +74,7 @@ public class JerseyAutoConfigurationCustomLoadOnStartupTests {
|
||||
@Documented
|
||||
@Configuration
|
||||
@Import({ EmbeddedServletContainerAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class, JerseyAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class })
|
||||
JerseyAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class })
|
||||
protected @interface MinimalWebConfiguration {
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
@@ -123,8 +122,8 @@ public class JerseyAutoConfigurationCustomObjectMapperProviderTests {
|
||||
@Documented
|
||||
@Configuration
|
||||
@Import({ EmbeddedServletContainerAutoConfiguration.class,
|
||||
JacksonAutoConfiguration.class, ServerPropertiesAutoConfiguration.class,
|
||||
JerseyAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class })
|
||||
JacksonAutoConfiguration.class, JerseyAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class })
|
||||
protected @interface MinimalWebConfiguration {
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
@@ -97,8 +96,7 @@ public class JerseyAutoConfigurationCustomServletContextPathTests {
|
||||
@Documented
|
||||
@Configuration
|
||||
@Import({ EmbeddedServletContainerAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class, JerseyAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class })
|
||||
JerseyAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class })
|
||||
protected @interface MinimalWebConfiguration {
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
@@ -97,8 +96,7 @@ public class JerseyAutoConfigurationCustomServletPathTests {
|
||||
@Documented
|
||||
@Configuration
|
||||
@Import({ EmbeddedServletContainerAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class, JerseyAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class })
|
||||
JerseyAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class })
|
||||
protected @interface MinimalWebConfiguration {
|
||||
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
@@ -94,8 +93,7 @@ public class JerseyAutoConfigurationDefaultFilterPathTests {
|
||||
@Documented
|
||||
@Configuration
|
||||
@Import({ EmbeddedServletContainerAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class, JerseyAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class })
|
||||
JerseyAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class })
|
||||
protected @interface MinimalWebConfiguration {
|
||||
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
@@ -95,8 +94,7 @@ public class JerseyAutoConfigurationDefaultServletPathTests {
|
||||
@Documented
|
||||
@Configuration
|
||||
@Import({ EmbeddedServletContainerAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class, JerseyAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class })
|
||||
JerseyAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class })
|
||||
protected @interface MinimalWebConfiguration {
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
@@ -134,8 +133,8 @@ public class JerseyAutoConfigurationObjectMapperProviderTests {
|
||||
@Documented
|
||||
@Configuration
|
||||
@Import({ EmbeddedServletContainerAutoConfiguration.class,
|
||||
JacksonAutoConfiguration.class, ServerPropertiesAutoConfiguration.class,
|
||||
JerseyAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class })
|
||||
JacksonAutoConfiguration.class, JerseyAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class })
|
||||
protected @interface MinimalWebConfiguration {
|
||||
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jersey.JerseyAutoConfigurationServletContainerTests.Application;
|
||||
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
@@ -69,8 +68,7 @@ public class JerseyAutoConfigurationServletContainerTests {
|
||||
}
|
||||
|
||||
@ImportAutoConfiguration({ EmbeddedServletContainerAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class, JerseyAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class })
|
||||
JerseyAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class })
|
||||
@Import(ContainerConfiguration.class)
|
||||
@Path("/hello")
|
||||
public static class Application extends ResourceConfig {
|
||||
|
||||
@@ -34,7 +34,6 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
@@ -94,8 +93,7 @@ public class JerseyAutoConfigurationWithoutApplicationPathTests {
|
||||
@Documented
|
||||
@Configuration
|
||||
@Import({ EmbeddedServletContainerAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class, JerseyAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class })
|
||||
JerseyAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class })
|
||||
protected @interface MinimalWebConfiguration {
|
||||
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.boot.context.embedded.EmbeddedWebApplicationContext;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
@@ -114,7 +113,6 @@ public class MustacheAutoConfigurationIntegrationTests {
|
||||
@Documented
|
||||
@Import({ MustacheAutoConfiguration.class,
|
||||
EmbeddedServletContainerAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class })
|
||||
protected @interface MinimalWebConfiguration {
|
||||
|
||||
@@ -38,7 +38,6 @@ import org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration
|
||||
import org.springframework.boot.autoconfigure.mustache.MustacheResourceTemplateLoader;
|
||||
import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.boot.context.embedded.EmbeddedWebApplicationContext;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
@@ -140,7 +139,6 @@ public class MustacheWebIntegrationTests {
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Import({ EmbeddedServletContainerAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class })
|
||||
protected @interface MinimalWebConfiguration {
|
||||
|
||||
@@ -28,7 +28,6 @@ import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoCon
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.orm.jpa.test.City;
|
||||
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.boot.test.util.EnvironmentTestUtils;
|
||||
import org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
@@ -86,7 +85,6 @@ public class SecurityAutoConfigurationTests {
|
||||
this.context = new AnnotationConfigWebApplicationContext();
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
this.context.register(SecurityAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
assertThat(this.context.getBean(AuthenticationManagerBuilder.class)).isNotNull();
|
||||
@@ -101,7 +99,6 @@ public class SecurityAutoConfigurationTests {
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
this.context.register(WebSecurity.class, SecurityAutoConfiguration.class,
|
||||
SecurityFilterAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
assertThat(this.context.getBean("securityFilterChainRegistration",
|
||||
@@ -114,7 +111,6 @@ public class SecurityAutoConfigurationTests {
|
||||
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
|
||||
context.register(SecurityAutoConfiguration.class,
|
||||
SecurityFilterAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
try {
|
||||
context.refresh();
|
||||
@@ -131,7 +127,6 @@ public class SecurityAutoConfigurationTests {
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
this.context.register(SecurityAutoConfiguration.class,
|
||||
SecurityFilterAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
assertThat(this.context.getBean("securityFilterChainRegistration",
|
||||
@@ -146,7 +141,6 @@ public class SecurityAutoConfigurationTests {
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
this.context.register(SecurityAutoConfiguration.class,
|
||||
SecurityFilterAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
assertThat(this.context.getBean("securityFilterChainRegistration",
|
||||
@@ -158,7 +152,6 @@ public class SecurityAutoConfigurationTests {
|
||||
this.context = new AnnotationConfigWebApplicationContext();
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
this.context.register(SecurityAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
EnvironmentTestUtils.addEnvironment(this.context, "security.ignored:none");
|
||||
this.context.refresh();
|
||||
@@ -172,7 +165,6 @@ public class SecurityAutoConfigurationTests {
|
||||
this.context = new AnnotationConfigWebApplicationContext();
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
this.context.register(SecurityAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
EnvironmentTestUtils.addEnvironment(this.context, "security.basic.enabled:false");
|
||||
this.context.refresh();
|
||||
@@ -186,7 +178,6 @@ public class SecurityAutoConfigurationTests {
|
||||
this.context = new AnnotationConfigWebApplicationContext();
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
this.context.register(SecurityAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
assertThat(this.context.getBean(AuthenticationManager.class)).isNotNull();
|
||||
@@ -218,7 +209,7 @@ public class SecurityAutoConfigurationTests {
|
||||
this.context = new AnnotationConfigWebApplicationContext();
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
this.context.register(TestAuthenticationConfiguration.class,
|
||||
SecurityAutoConfiguration.class, ServerPropertiesAutoConfiguration.class,
|
||||
SecurityAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
assertThat(this.context.getBean(AuthenticationManager.class))
|
||||
@@ -232,7 +223,7 @@ public class SecurityAutoConfigurationTests {
|
||||
this.context = new AnnotationConfigWebApplicationContext();
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
this.context.register(UserDetailsSecurityCustomizer.class,
|
||||
SecurityAutoConfiguration.class, ServerPropertiesAutoConfiguration.class,
|
||||
SecurityAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
assertThat(this.context.getBean(UserDetailsSecurityCustomizer.class)
|
||||
@@ -246,7 +237,6 @@ public class SecurityAutoConfigurationTests {
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
this.context.register(TestAuthenticationConfiguration.class,
|
||||
SecurityCustomizer.class, SecurityAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
assertThat(this.context.getBean(AuthenticationManager.class))
|
||||
@@ -261,7 +251,6 @@ public class SecurityAutoConfigurationTests {
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
this.context.register(AuthenticationManagerCustomizer.class,
|
||||
SecurityCustomizer.class, SecurityAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
UsernamePasswordAuthenticationToken user = new UsernamePasswordAuthenticationToken(
|
||||
@@ -279,7 +268,6 @@ public class SecurityAutoConfigurationTests {
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
this.context.register(AuthenticationManagerCustomizer.class,
|
||||
WorkaroundSecurityCustomizer.class, SecurityAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
UsernamePasswordAuthenticationToken user = new UsernamePasswordAuthenticationToken(
|
||||
@@ -300,7 +288,7 @@ public class SecurityAutoConfigurationTests {
|
||||
this.context.register(EntityConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class,
|
||||
DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class,
|
||||
SecurityAutoConfiguration.class, ServerPropertiesAutoConfiguration.class);
|
||||
SecurityAutoConfiguration.class);
|
||||
// This can fail if security @Conditionals force early instantiation of the
|
||||
// HibernateJpaAutoConfiguration (e.g. the EntityManagerFactory is not found)
|
||||
this.context.refresh();
|
||||
@@ -312,8 +300,7 @@ public class SecurityAutoConfigurationTests {
|
||||
this.context = new AnnotationConfigWebApplicationContext();
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
|
||||
this.context.register(SecurityAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class);
|
||||
this.context.register(SecurityAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
|
||||
SecurityProperties security = this.context.getBean(SecurityProperties.class);
|
||||
@@ -331,7 +318,7 @@ public class SecurityAutoConfigurationTests {
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
|
||||
this.context.register(AuthenticationManagerCustomizer.class,
|
||||
SecurityAutoConfiguration.class, ServerPropertiesAutoConfiguration.class);
|
||||
SecurityAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
|
||||
SecurityProperties security = this.context.getBean(SecurityProperties.class);
|
||||
@@ -356,7 +343,7 @@ public class SecurityAutoConfigurationTests {
|
||||
this.context = new AnnotationConfigWebApplicationContext();
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
this.context.register(AuthenticationManagerCustomizer.class,
|
||||
SecurityAutoConfiguration.class, ServerPropertiesAutoConfiguration.class);
|
||||
SecurityAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
assertThat(this.context.getBean(SecurityEvaluationContextExtension.class))
|
||||
.isNotNull();
|
||||
@@ -368,7 +355,6 @@ public class SecurityAutoConfigurationTests {
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
this.context.register(SecurityAutoConfiguration.class,
|
||||
SecurityFilterAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
DelegatingFilterProxyRegistrationBean bean = this.context.getBean(
|
||||
@@ -386,7 +372,6 @@ public class SecurityAutoConfigurationTests {
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
this.context.register(SecurityAutoConfiguration.class,
|
||||
SecurityFilterAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"security.filter-dispatcher-types:INCLUDE,ERROR");
|
||||
|
||||
@@ -32,7 +32,6 @@ import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.security.SecurityAutoConfigurationTests.WebSecurity;
|
||||
import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
|
||||
import org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext;
|
||||
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
|
||||
@@ -84,7 +83,6 @@ public class SecurityFilterAutoConfigurationEarlyInitializationTests {
|
||||
JacksonAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class, WebSecurity.class,
|
||||
SecurityAutoConfiguration.class, SecurityFilterAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class })
|
||||
static class Config {
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ import org.springframework.boot.autoconfigure.security.SecurityFilterAutoConfigu
|
||||
import org.springframework.boot.autoconfigure.security.SecurityFilterAutoConfigurationEarlyInitializationTests.JacksonModuleBean;
|
||||
import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
@@ -64,7 +63,6 @@ public class SecurityFilterAutoConfigurationTests {
|
||||
JacksonAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class, WebSecurity.class,
|
||||
SecurityFilterAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class })
|
||||
static class Config {
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfigura
|
||||
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
@@ -323,7 +322,6 @@ public class SpringBootWebSecurityConfigurationTests {
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Import({ EmbeddedServletContainerAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class,
|
||||
HttpMessageConvertersAutoConfiguration.class, ErrorMvcAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class })
|
||||
|
||||
@@ -33,7 +33,6 @@ import org.springframework.boot.autoconfigure.security.oauth2.resource.OAuth2Res
|
||||
import org.springframework.boot.autoconfigure.security.oauth2.resource.ResourceServerProperties;
|
||||
import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
|
||||
import org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext;
|
||||
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
|
||||
@@ -462,9 +461,9 @@ public class OAuth2AutoConfigurationTests {
|
||||
|
||||
@Configuration
|
||||
@Import({ UseFreePortEmbeddedContainerConfiguration.class,
|
||||
SecurityAutoConfiguration.class, ServerPropertiesAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class, OAuth2AutoConfiguration.class,
|
||||
WebMvcAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class })
|
||||
SecurityAutoConfiguration.class, DispatcherServletAutoConfiguration.class,
|
||||
OAuth2AutoConfiguration.class, WebMvcAutoConfiguration.class,
|
||||
HttpMessageConvertersAutoConfiguration.class })
|
||||
protected static class MinimalSecureWebApplication {
|
||||
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoCon
|
||||
import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
|
||||
import org.springframework.boot.context.embedded.LocalServerPort;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
@@ -114,7 +113,6 @@ public class UserInfoTokenServicesRefreshTokenTests {
|
||||
@Import({ EmbeddedServletContainerAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class,
|
||||
HttpMessageConvertersAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class })
|
||||
|
||||
@RestController
|
||||
|
||||
@@ -28,7 +28,6 @@ import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfigura
|
||||
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
@@ -38,10 +37,9 @@ import org.springframework.context.annotation.Import;
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Import({ EmbeddedServletContainerAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class, DispatcherServletAutoConfiguration.class,
|
||||
WebMvcAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class,
|
||||
ErrorMvcAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class,
|
||||
SecurityAutoConfiguration.class })
|
||||
DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class,
|
||||
HttpMessageConvertersAutoConfiguration.class, ErrorMvcAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class, SecurityAutoConfiguration.class })
|
||||
public @interface MinimalSecureWebConfiguration {
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.junit.After;
|
||||
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerProperties;
|
||||
import org.springframework.boot.test.util.EnvironmentTestUtils;
|
||||
import org.springframework.session.SessionRepository;
|
||||
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
|
||||
@@ -67,8 +67,7 @@ public abstract class AbstractSessionAutoConfigurationTests {
|
||||
if (configs != null) {
|
||||
ctx.register(configs.toArray(new Class<?>[configs.size()]));
|
||||
}
|
||||
ctx.register(ServerPropertiesAutoConfiguration.class,
|
||||
SessionAutoConfiguration.class,
|
||||
ctx.register(ServerProperties.class, SessionAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
ctx.refresh();
|
||||
this.context = ctx;
|
||||
|
||||
@@ -125,7 +125,6 @@ public class BasicErrorControllerDirectMockMvcTests {
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Import({ EmbeddedServletContainerAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class,
|
||||
HttpMessageConvertersAutoConfiguration.class, ErrorMvcAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class })
|
||||
|
||||
@@ -127,7 +127,6 @@ public class BasicErrorControllerMockMvcTests {
|
||||
@Documented
|
||||
@Import({ EmbeddedServletContainerAutoConfiguration.EmbeddedTomcat.class,
|
||||
EmbeddedServletContainerAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class,
|
||||
HttpMessageConvertersAutoConfiguration.class, ErrorMvcAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class })
|
||||
|
||||
@@ -109,7 +109,6 @@ public class DefaultErrorViewIntegrationTests {
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Import({ EmbeddedServletContainerAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class,
|
||||
HttpMessageConvertersAutoConfiguration.class, ErrorMvcAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class })
|
||||
|
||||
@@ -59,8 +59,7 @@ public class DispatcherServletAutoConfigurationTests {
|
||||
@Test
|
||||
public void registrationProperties() throws Exception {
|
||||
this.context = new AnnotationConfigWebApplicationContext();
|
||||
this.context.register(ServerPropertiesAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class);
|
||||
this.context.register(DispatcherServletAutoConfiguration.class);
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
this.context.refresh();
|
||||
assertThat(this.context.getBean(DispatcherServlet.class)).isNotNull();
|
||||
@@ -73,7 +72,6 @@ public class DispatcherServletAutoConfigurationTests {
|
||||
public void registrationNonServletBean() throws Exception {
|
||||
this.context = new AnnotationConfigWebApplicationContext();
|
||||
this.context.register(NonServletConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class);
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
this.context.refresh();
|
||||
@@ -89,7 +87,6 @@ public class DispatcherServletAutoConfigurationTests {
|
||||
public void registrationOverrideWithDispatcherServletWrongName() throws Exception {
|
||||
this.context = new AnnotationConfigWebApplicationContext();
|
||||
this.context.register(CustomDispatcherServletWrongName.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class);
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
this.context.refresh();
|
||||
@@ -105,7 +102,6 @@ public class DispatcherServletAutoConfigurationTests {
|
||||
public void registrationOverrideWithAutowiredServlet() throws Exception {
|
||||
this.context = new AnnotationConfigWebApplicationContext();
|
||||
this.context.register(CustomAutowiredRegistration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class);
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
this.context.refresh();
|
||||
@@ -121,8 +117,7 @@ public class DispatcherServletAutoConfigurationTests {
|
||||
public void servletPath() throws Exception {
|
||||
this.context = new AnnotationConfigWebApplicationContext();
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
this.context.register(ServerPropertiesAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class);
|
||||
this.context.register(DispatcherServletAutoConfiguration.class);
|
||||
EnvironmentTestUtils.addEnvironment(this.context, "server.servlet_path:/spring");
|
||||
this.context.refresh();
|
||||
assertThat(this.context.getBean(DispatcherServlet.class)).isNotNull();
|
||||
@@ -137,7 +132,6 @@ public class DispatcherServletAutoConfigurationTests {
|
||||
this.context = new AnnotationConfigWebApplicationContext();
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
this.context.register(MultipartConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
ServletRegistrationBean registration = this.context
|
||||
@@ -150,7 +144,6 @@ public class DispatcherServletAutoConfigurationTests {
|
||||
this.context = new AnnotationConfigWebApplicationContext();
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
this.context.register(MultipartResolverConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
DispatcherServlet dispatcherServlet = this.context
|
||||
@@ -164,8 +157,7 @@ public class DispatcherServletAutoConfigurationTests {
|
||||
public void dispatcherServletDefaultConfig() {
|
||||
this.context = new AnnotationConfigWebApplicationContext();
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
this.context.register(ServerPropertiesAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class);
|
||||
this.context.register(DispatcherServletAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
DispatcherServlet bean = this.context.getBean(DispatcherServlet.class);
|
||||
assertThat(bean).extracting("throwExceptionIfNoHandlerFound")
|
||||
@@ -181,8 +173,7 @@ public class DispatcherServletAutoConfigurationTests {
|
||||
public void dispatcherServletCustomConfig() {
|
||||
this.context = new AnnotationConfigWebApplicationContext();
|
||||
this.context.setServletContext(new MockServletContext());
|
||||
this.context.register(ServerPropertiesAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class);
|
||||
this.context.register(DispatcherServletAutoConfiguration.class);
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.mvc.throw-exception-if-no-handler-found:true",
|
||||
"spring.mvc.dispatch-options-request:false",
|
||||
|
||||
@@ -147,8 +147,7 @@ public class EmbeddedServletContainerAutoConfigurationTests {
|
||||
@Configuration
|
||||
@Import({ EmbeddedContainerConfiguration.class,
|
||||
EmbeddedServletContainerAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class })
|
||||
DispatcherServletAutoConfiguration.class })
|
||||
protected static class BaseConfiguration {
|
||||
|
||||
}
|
||||
|
||||
@@ -88,8 +88,7 @@ public class FilterOrderingIntegrationTests {
|
||||
"spring.session.store-type=hash-map");
|
||||
this.context.register(MockEmbeddedServletContainerConfiguration.class,
|
||||
TestRedisConfiguration.class, WebMvcAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class, SecurityAutoConfiguration.class,
|
||||
SessionAutoConfiguration.class,
|
||||
SecurityAutoConfiguration.class, SessionAutoConfiguration.class,
|
||||
HttpMessageConvertersAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class,
|
||||
HttpEncodingAutoConfiguration.class);
|
||||
|
||||
@@ -258,8 +258,7 @@ public class MultipartAutoConfigurationTests {
|
||||
|
||||
@Configuration
|
||||
@Import({ EmbeddedServletContainerAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class, MultipartAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class })
|
||||
DispatcherServletAutoConfiguration.class, MultipartAutoConfiguration.class })
|
||||
@EnableConfigurationProperties(MultipartProperties.class)
|
||||
protected static class BaseConfiguration {
|
||||
|
||||
|
||||
@@ -70,8 +70,7 @@ public class RemappedErrorViewIntegrationTests {
|
||||
|
||||
@Configuration
|
||||
@Import({ PropertyPlaceholderAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class, WebMvcAutoConfiguration.class,
|
||||
HttpMessageConvertersAutoConfiguration.class,
|
||||
WebMvcAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class,
|
||||
EmbeddedServletContainerAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class, ErrorMvcAutoConfiguration.class })
|
||||
@Controller
|
||||
|
||||
@@ -34,8 +34,8 @@ import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory
|
||||
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory;
|
||||
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
|
||||
import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.boot.test.util.EnvironmentTestUtils;
|
||||
import org.springframework.context.ApplicationContextException;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@@ -44,12 +44,12 @@ import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
/**
|
||||
* Tests for {@link ServerPropertiesAutoConfiguration}.
|
||||
* Integration tests for {@link ServerProperties}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Ivan Sopov
|
||||
*/
|
||||
public class ServerPropertiesAutoConfigurationTests {
|
||||
public class ServerPropertiesIntegrationTests {
|
||||
|
||||
private static AbstractEmbeddedServletContainerFactory containerFactory;
|
||||
|
||||
@@ -73,8 +73,7 @@ public class ServerPropertiesAutoConfigurationTests {
|
||||
@Test
|
||||
public void createFromConfigClass() throws Exception {
|
||||
this.context = new AnnotationConfigEmbeddedWebApplicationContext();
|
||||
this.context.register(Config.class, ServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
this.context.register(Config.class, PropertyPlaceholderAutoConfiguration.class);
|
||||
EnvironmentTestUtils.addEnvironment(this.context, "server.port:9000");
|
||||
this.context.refresh();
|
||||
ServerProperties server = this.context.getBean(ServerProperties.class);
|
||||
@@ -87,8 +86,7 @@ public class ServerPropertiesAutoConfigurationTests {
|
||||
public void tomcatProperties() throws Exception {
|
||||
containerFactory = mock(TomcatEmbeddedServletContainerFactory.class);
|
||||
this.context = new AnnotationConfigEmbeddedWebApplicationContext();
|
||||
this.context.register(Config.class, ServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
this.context.register(Config.class, PropertyPlaceholderAutoConfiguration.class);
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"server.tomcat.basedir:target/foo", "server.port:9000");
|
||||
this.context.refresh();
|
||||
@@ -102,7 +100,6 @@ public class ServerPropertiesAutoConfigurationTests {
|
||||
public void customizeWithJettyContainerFactory() throws Exception {
|
||||
this.context = new AnnotationConfigEmbeddedWebApplicationContext();
|
||||
this.context.register(CustomJettyContainerConfig.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
containerFactory = this.context
|
||||
@@ -118,7 +115,6 @@ public class ServerPropertiesAutoConfigurationTests {
|
||||
public void customizeWithUndertowContainerFactory() throws Exception {
|
||||
this.context = new AnnotationConfigEmbeddedWebApplicationContext();
|
||||
this.context.register(CustomUndertowContainerConfig.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
containerFactory = this.context
|
||||
@@ -133,7 +129,6 @@ public class ServerPropertiesAutoConfigurationTests {
|
||||
containerFactory = mock(TomcatEmbeddedServletContainerFactory.class);
|
||||
this.context = new AnnotationConfigEmbeddedWebApplicationContext();
|
||||
this.context.register(Config.class, CustomizeConfig.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
ServerProperties server = this.context.getBean(ServerProperties.class);
|
||||
@@ -143,23 +138,13 @@ public class ServerPropertiesAutoConfigurationTests {
|
||||
verify(containerFactory).setPort(3000);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAccidentalMultipleServerPropertiesBeans() throws Exception {
|
||||
this.context = new AnnotationConfigEmbeddedWebApplicationContext();
|
||||
this.context.register(Config.class, MultiServerPropertiesBeanConfig.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
this.thrown.expect(ApplicationContextException.class);
|
||||
this.thrown.expectMessage("Multiple ServerProperties");
|
||||
this.context.refresh();
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(ServerProperties.class)
|
||||
protected static class Config {
|
||||
|
||||
@Bean
|
||||
public EmbeddedServletContainerFactory containerFactory() {
|
||||
return ServerPropertiesAutoConfigurationTests.containerFactory;
|
||||
return ServerPropertiesIntegrationTests.containerFactory;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -170,6 +155,7 @@ public class ServerPropertiesAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(ServerProperties.class)
|
||||
protected static class CustomJettyContainerConfig {
|
||||
|
||||
@Bean
|
||||
@@ -187,6 +173,7 @@ public class ServerPropertiesAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(ServerProperties.class)
|
||||
protected static class CustomUndertowContainerConfig {
|
||||
|
||||
@Bean
|
||||
@@ -220,19 +207,4 @@ public class ServerPropertiesAutoConfigurationTests {
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
protected static class MultiServerPropertiesBeanConfig {
|
||||
|
||||
@Bean
|
||||
public ServerProperties serverPropertiesOne() {
|
||||
return new ServerProperties();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ServerProperties serverPropertiesTwo() {
|
||||
return new ServerProperties();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -35,7 +35,6 @@ import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
|
||||
import org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext;
|
||||
import org.springframework.boot.context.embedded.ServerPortInfoApplicationContextInitializer;
|
||||
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
|
||||
@@ -210,7 +209,6 @@ public class WebSocketMessagingAutoConfigurationTests {
|
||||
@EnableWebSocketMessageBroker
|
||||
@ImportAutoConfiguration({ JacksonAutoConfiguration.class,
|
||||
EmbeddedServletContainerAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
WebSocketMessagingAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class })
|
||||
static class WebSocketMessagingConfiguration
|
||||
|
||||
Reference in New Issue
Block a user