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
pull/8054/merge
Stephane Nicoll 8 years ago
parent e0c8e1f514
commit 6af6e8e31b

@ -29,11 +29,8 @@ import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.SmartInitializingSingleton;
import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.boot.actuate.endpoint.Endpoint;
import org.springframework.boot.actuate.endpoint.mvc.ManagementServletContext;
@ -52,13 +49,13 @@ import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfigura
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
import org.springframework.boot.bind.RelaxedPropertyResolver;
import org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext;
import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.EmbeddedWebApplicationContext;
import org.springframework.boot.context.event.ApplicationFailedEvent;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.filter.ApplicationContextHeaderFilter;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
@ -76,7 +73,6 @@ import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.Environment;
import org.springframework.core.env.PropertySource;
import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.core.type.MethodMetadata;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;
@ -98,9 +94,9 @@ import org.springframework.web.servlet.DispatcherServlet;
@Configuration
@ConditionalOnClass({ Servlet.class, DispatcherServlet.class })
@ConditionalOnWebApplication
@EnableConfigurationProperties(ManagementServerProperties.class)
@AutoConfigureAfter({ PropertyPlaceholderAutoConfiguration.class,
EmbeddedServletContainerAutoConfiguration.class, WebMvcAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
RepositoryRestMvcAutoConfiguration.class, HypermediaAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class })
public class EndpointWebMvcAutoConfiguration
@ -147,7 +143,7 @@ public class EndpointWebMvcAutoConfiguration
ManagementServerPort managementPort = ManagementServerPort.DIFFERENT;
if (this.applicationContext instanceof WebApplicationContext) {
managementPort = ManagementServerPort
.get(this.applicationContext.getEnvironment(), this.beanFactory);
.get(this.applicationContext.getEnvironment());
}
if (managementPort == ManagementServerPort.DIFFERENT) {
if (this.applicationContext instanceof EmbeddedWebApplicationContext
@ -342,8 +338,8 @@ public class EndpointWebMvcAutoConfiguration
return ConditionOutcome
.noMatch(message.because("non WebApplicationContext"));
}
ManagementServerPort port = ManagementServerPort.get(context.getEnvironment(),
context.getBeanFactory());
ManagementServerPort port = ManagementServerPort.get(
context.getEnvironment());
if (port == ManagementServerPort.SAME) {
return ConditionOutcome.match(message.because("port is same"));
}
@ -356,21 +352,9 @@ public class EndpointWebMvcAutoConfiguration
DISABLE, SAME, DIFFERENT;
public static ManagementServerPort get(Environment environment,
BeanFactory beanFactory) {
public static ManagementServerPort get(Environment environment) {
Integer serverPort = getPortProperty(environment, "server.");
if (serverPort == null && hasCustomBeanDefinition(beanFactory,
ServerProperties.class, ServerPropertiesAutoConfiguration.class)) {
serverPort = getTemporaryBean(beanFactory, ServerProperties.class)
.getPort();
}
Integer managementPort = getPortProperty(environment, "management.");
if (managementPort == null && hasCustomBeanDefinition(beanFactory,
ManagementServerProperties.class,
ManagementServerPropertiesAutoConfiguration.class)) {
managementPort = getTemporaryBean(beanFactory,
ManagementServerProperties.class).getPort();
}
if (managementPort != null && managementPort < 0) {
return DISABLE;
}
@ -380,63 +364,12 @@ public class EndpointWebMvcAutoConfiguration
: DIFFERENT);
}
private static <T> T getTemporaryBean(BeanFactory beanFactory, Class<T> type) {
if (!(beanFactory instanceof ConfigurableListableBeanFactory)) {
return null;
}
ConfigurableListableBeanFactory listable = (ConfigurableListableBeanFactory) beanFactory;
String[] names = listable.getBeanNamesForType(type, true, false);
if (names == null || names.length != 1) {
return null;
}
// Use a temporary child bean factory to avoid instantiating the bean in the
// parent (it won't be bound to the environment yet)
return createTemporaryBean(type, listable,
listable.getBeanDefinition(names[0]));
}
private static <T> T createTemporaryBean(Class<T> type,
ConfigurableListableBeanFactory parent, BeanDefinition definition) {
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(
parent);
beanFactory.registerBeanDefinition(type.getName(), definition);
return beanFactory.getBean(type);
}
private static Integer getPortProperty(Environment environment, String prefix) {
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(environment,
prefix);
return resolver.getProperty("port", Integer.class);
}
private static <T> boolean hasCustomBeanDefinition(BeanFactory beanFactory,
Class<T> type, Class<?> configClass) {
if (!(beanFactory instanceof ConfigurableListableBeanFactory)) {
return false;
}
return hasCustomBeanDefinition((ConfigurableListableBeanFactory) beanFactory,
type, configClass);
}
private static <T> boolean hasCustomBeanDefinition(
ConfigurableListableBeanFactory beanFactory, Class<T> type,
Class<?> configClass) {
String[] names = beanFactory.getBeanNamesForType(type, true, false);
if (names == null || names.length != 1) {
return false;
}
BeanDefinition definition = beanFactory.getBeanDefinition(names[0]);
if (definition instanceof AnnotatedBeanDefinition) {
MethodMetadata factoryMethodMetadata = ((AnnotatedBeanDefinition) definition)
.getFactoryMethodMetadata();
if (factoryMethodMetadata != null) {
String className = factoryMethodMetadata.getDeclaringClassName();
return !configClass.getName().equals(className);
}
}
return true;
}
}
}

@ -52,7 +52,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnResource;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.boot.autoconfigure.web.ResourceProperties;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
@ -95,7 +94,8 @@ import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
@ConditionalOnWebApplication
@ConditionalOnBean(HttpMessageConverters.class)
@Conditional(EndpointHypermediaEnabledCondition.class)
@EnableConfigurationProperties(ResourceProperties.class)
@EnableConfigurationProperties({ ResourceProperties.class,
ManagementServerProperties.class })
public class EndpointWebMvcHypermediaManagementContextConfiguration {
@Bean
@ -126,7 +126,7 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration {
@ConditionalOnBean(DocsMvcEndpoint.class)
@ConditionalOnMissingBean(CurieProvider.class)
@ConditionalOnProperty(prefix = "endpoints.docs.curies", name = "enabled", matchIfMissing = false)
public DefaultCurieProvider curieProvider(ServerProperties server,
public DefaultCurieProvider curieProvider(
ManagementServerProperties management, DocsMvcEndpoint endpoint) {
String path = management.getContextPath() + endpoint.getPath()
+ "/#spring_boot_actuator__{rel}";

@ -1,64 +0,0 @@
/*
* Copyright 2012-2014 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.actuate.autoconfigure;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
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.autoconfigure.security.SecurityProperties;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* {@link EnableAutoConfiguration Auto-configuration} for the
* {@link ManagementServerProperties} bean.
*
* @author Dave Syer
*/
@Configuration
@AutoConfigureAfter(ServerPropertiesAutoConfiguration.class)
@EnableConfigurationProperties
public class ManagementServerPropertiesAutoConfiguration {
@Bean
@ConditionalOnMissingBean
public ManagementServerProperties managementServerProperties() {
return new ManagementServerProperties();
}
// In case security auto configuration hasn't been included
@Bean
@ConditionalOnMissingBean
@ConditionalOnClass(name = "org.springframework.security.config.annotation.web.configuration.EnableWebSecurity")
public SecurityProperties securityProperties() {
return new SecurityProperties();
}
// In case server auto configuration hasn't been included
@Bean
@ConditionalOnMissingBean
@ConditionalOnWebApplication
public ServerProperties serverProperties() {
return new ServerProperties();
}
}

@ -89,7 +89,7 @@ import org.springframework.util.StringUtils;
@ConditionalOnClass({ EnableWebSecurity.class })
@AutoConfigureAfter(SecurityAutoConfiguration.class)
@AutoConfigureBefore(FallbackWebSecurityAutoConfiguration.class)
@EnableConfigurationProperties
@EnableConfigurationProperties(ManagementServerProperties.class)
public class ManagementWebSecurityAutoConfiguration {
private static final String[] NO_PATHS = new String[0];
@ -189,6 +189,7 @@ public class ManagementWebSecurityAutoConfiguration {
@Configuration
@ConditionalOnMissingBean({ ManagementWebSecurityConfigurerAdapter.class })
@ConditionalOnProperty(prefix = "management.security", name = "enabled", matchIfMissing = true)
@EnableConfigurationProperties(SecurityProperties.class)
@Order(ManagementServerProperties.BASIC_AUTH_ORDER)
protected static class ManagementWebSecurityConfigurerAdapter
extends WebSecurityConfigurerAdapter {

@ -7,7 +7,6 @@ org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.HealthIndicatorAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.InfoContributorAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.JolokiaAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.ManagementWebSecurityAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.MetricFilterAutoConfiguration,\
org.springframework.boot.actuate.autoconfigure.MetricRepositoryAutoConfiguration,\

@ -45,7 +45,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.HttpMessageConverters;
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;
@ -101,8 +100,7 @@ public class EndpointMvcIntegrationTests {
@Configuration
@MinimalWebConfiguration
@Import({ ManagementServerPropertiesAutoConfiguration.class,
JacksonAutoConfiguration.class, EndpointAutoConfiguration.class,
@Import({ JacksonAutoConfiguration.class, EndpointAutoConfiguration.class,
EndpointWebMvcAutoConfiguration.class, AuditAutoConfiguration.class })
@RestController
protected static class Application {
@ -155,7 +153,6 @@ public class EndpointMvcIntegrationTests {
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Import({ EmbeddedServletContainerAutoConfiguration.class,
ServerPropertiesAutoConfiguration.class,
DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class,
JacksonAutoConfiguration.class, ErrorMvcAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class })

@ -60,10 +60,8 @@ import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoCo
import org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration;
import org.springframework.boot.autoconfigure.web.ServerProperties;
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.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerException;
import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
@ -117,27 +115,20 @@ public class EndpointWebMvcAutoConfigurationTests {
@Rule
public ExpectedException thrown = ExpectedException.none();
private final AnnotationConfigEmbeddedWebApplicationContext applicationContext = new AnnotationConfigEmbeddedWebApplicationContext();
private final AnnotationConfigEmbeddedWebApplicationContext applicationContext =
new AnnotationConfigEmbeddedWebApplicationContext();
private static ThreadLocal<Ports> ports = new ThreadLocal<Ports>();
private static ServerProperties server = new ServerProperties();
private static ManagementServerProperties management = new ManagementServerProperties();
@Before
public void defaultContextPath() {
management.setContextPath("");
management.getSecurity().setEnabled(false);
server.setContextPath("");
}
@Before
public void grabPorts() {
public void setUp() {
Ports values = new Ports();
ports.set(values);
server.setPort(values.server);
management.setPort(values.management);
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"management.context-path=",
"management.security.enabled=false",
"server.context-path=",
"server.port=" + ports.get().server);
}
@After
@ -149,10 +140,9 @@ public class EndpointWebMvcAutoConfigurationTests {
@Test
public void onSamePort() throws Exception {
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"management.security.enabled:false");
"management.security.enabled=false");
this.applicationContext.register(RootConfig.class, EndpointConfig.class,
BaseConfiguration.class, ServerPortConfig.class,
EndpointWebMvcAutoConfiguration.class);
BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class);
this.applicationContext.refresh();
assertContent("/controller", ports.get().server, "controlleroutput");
assertContent("/endpoint", ports.get().server, "endpointoutput");
@ -169,8 +159,7 @@ public class EndpointWebMvcAutoConfigurationTests {
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"management.add-application-context-header:false");
this.applicationContext.register(RootConfig.class, EndpointConfig.class,
BaseConfiguration.class, ServerPortConfig.class,
EndpointWebMvcAutoConfiguration.class);
BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class);
this.applicationContext.refresh();
assertThat(hasHeader("/endpoint", ports.get().server, "X-Application-Context"))
.isFalse();
@ -180,6 +169,8 @@ public class EndpointWebMvcAutoConfigurationTests {
@Test
public void onDifferentPort() throws Exception {
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"management.port=" + ports.get().management);
this.applicationContext.register(RootConfig.class, EndpointConfig.class,
DifferentPortConfig.class, BaseConfiguration.class,
EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class);
@ -198,6 +189,8 @@ public class EndpointWebMvcAutoConfigurationTests {
@Test
public void onDifferentPortWithSpecificContainer() throws Exception {
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"management.port=" + ports.get().management);
this.applicationContext.register(SpecificContainerConfig.class, RootConfig.class,
DifferentPortConfig.class, EndpointConfig.class, BaseConfiguration.class,
EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class);
@ -225,10 +218,12 @@ public class EndpointWebMvcAutoConfigurationTests {
@Test
public void onDifferentPortAndContext() throws Exception {
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"management.port=" + ports.get().management,
"management.context-path=/admin");
this.applicationContext.register(RootConfig.class, EndpointConfig.class,
DifferentPortConfig.class, BaseConfiguration.class,
EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class);
management.setContextPath("/admin");
this.applicationContext.refresh();
assertContent("/controller", ports.get().server, "controlleroutput");
assertContent("/admin/endpoint", ports.get().management, "endpointoutput");
@ -237,11 +232,13 @@ public class EndpointWebMvcAutoConfigurationTests {
@Test
public void onDifferentPortAndMainContext() throws Exception {
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"server.context-path=/spring",
"management.port=" + ports.get().management,
"management.context-path=/admin");
this.applicationContext.register(RootConfig.class, EndpointConfig.class,
DifferentPortConfig.class, BaseConfiguration.class,
EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class);
management.setContextPath("/admin");
server.setContextPath("/spring");
this.applicationContext.refresh();
assertContent("/spring/controller", ports.get().server, "controlleroutput");
assertContent("/admin/endpoint", ports.get().management, "endpointoutput");
@ -250,6 +247,8 @@ public class EndpointWebMvcAutoConfigurationTests {
@Test
public void onDifferentPortWithoutErrorMvcAutoConfiguration() throws Exception {
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"management.port=" + ports.get().management);
this.applicationContext.register(RootConfig.class, EndpointConfig.class,
DifferentPortConfig.class, BaseConfiguration.class,
EndpointWebMvcAutoConfiguration.class);
@ -259,6 +258,8 @@ public class EndpointWebMvcAutoConfigurationTests {
@Test
public void onDifferentPortInServletContainer() throws Exception {
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"management.port=" + ports.get().management);
this.applicationContext.register(RootConfig.class, EndpointConfig.class,
DifferentPortConfig.class, BaseConfiguration.class,
EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class);
@ -275,9 +276,11 @@ public class EndpointWebMvcAutoConfigurationTests {
@Test
public void onRandomPort() throws Exception {
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"management.port=0", "management.security.enabled=false");
this.applicationContext.register(RootConfig.class, EndpointConfig.class,
RandomPortConfig.class, BaseConfiguration.class,
EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class);
BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class,
ErrorMvcAutoConfiguration.class);
GrabManagementPort grabManagementPort = new GrabManagementPort(
this.applicationContext);
this.applicationContext.addApplicationListener(grabManagementPort);
@ -292,6 +295,8 @@ public class EndpointWebMvcAutoConfigurationTests {
@Test
public void onDifferentPortWithPrimaryFailure() throws Exception {
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"management.port=" + ports.get().management);
this.applicationContext.register(RootConfig.class, EndpointConfig.class,
DifferentPortConfig.class, BaseConfiguration.class,
EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class);
@ -307,9 +312,10 @@ public class EndpointWebMvcAutoConfigurationTests {
@Test
public void disabled() throws Exception {
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"management.port=-1");
this.applicationContext.register(RootConfig.class, EndpointConfig.class,
DisableConfig.class, BaseConfiguration.class,
EndpointWebMvcAutoConfiguration.class);
BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class);
this.applicationContext.refresh();
assertContent("/controller", ports.get().server, "controlleroutput");
assertContent("/endpoint", ports.get().server, null);
@ -358,9 +364,8 @@ public class EndpointWebMvcAutoConfigurationTests {
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"management.contextPath:/test", "management.security.enabled:false");
this.applicationContext.register(RootConfig.class, EndpointConfig.class,
ServerPortConfig.class, PropertyPlaceholderAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
ServerPropertiesAutoConfiguration.class, JacksonAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class,
JacksonAutoConfiguration.class,
EmbeddedServletContainerAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class,
@ -375,9 +380,8 @@ public class EndpointWebMvcAutoConfigurationTests {
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"server.displayName:foo");
this.applicationContext.register(RootConfig.class, EndpointConfig.class,
ServerPortConfig.class, PropertyPlaceholderAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
ServerPropertiesAutoConfiguration.class, JacksonAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class,
JacksonAutoConfiguration.class,
EmbeddedServletContainerAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class,
@ -392,7 +396,7 @@ public class EndpointWebMvcAutoConfigurationTests {
@Test
public void portPropertiesOnSamePort() throws Exception {
this.applicationContext.register(RootConfig.class, BaseConfiguration.class,
ServerPortConfig.class, EndpointWebMvcAutoConfiguration.class);
EndpointWebMvcAutoConfiguration.class);
new ServerPortInfoApplicationContextInitializer()
.initialize(this.applicationContext);
this.applicationContext.refresh();
@ -407,6 +411,8 @@ public class EndpointWebMvcAutoConfigurationTests {
@Test
public void portPropertiesOnDifferentPort() throws Exception {
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"management.port=" + ports.get().management);
new ServerPortInfoApplicationContextInitializer()
.initialize(this.applicationContext);
this.applicationContext.register(RootConfig.class, DifferentPortConfig.class,
@ -420,14 +426,12 @@ public class EndpointWebMvcAutoConfigurationTests {
assertThat(localServerPort).isNotNull();
assertThat(localManagementPort).isNotNull();
assertThat(localServerPort).isNotEqualTo(localManagementPort);
assertThat(this.applicationContext.getBean(ServerPortConfig.class).getCount())
.isEqualTo(2);
}
@Test
public void singleRequestMappingInfoHandlerMappingBean() throws Exception {
this.applicationContext.register(RootConfig.class, BaseConfiguration.class,
ServerPortConfig.class, EndpointWebMvcAutoConfiguration.class);
EndpointWebMvcAutoConfiguration.class);
this.applicationContext.refresh();
RequestMappingInfoHandlerMapping mapping = this.applicationContext
.getBean(RequestMappingInfoHandlerMapping.class);
@ -437,8 +441,7 @@ public class EndpointWebMvcAutoConfigurationTests {
@Test
public void endpointsDefaultConfiguration() throws Exception {
this.applicationContext.register(LoggingConfig.class, RootConfig.class,
BaseConfiguration.class, ServerPortConfig.class,
EndpointWebMvcAutoConfiguration.class);
BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class);
this.applicationContext.refresh();
// /health, /metrics, /loggers, /env, /actuator, /heapdump, /auditevents
// (/shutdown is disabled by default)
@ -448,7 +451,7 @@ public class EndpointWebMvcAutoConfigurationTests {
@Test
public void endpointsAllDisabled() throws Exception {
this.applicationContext.register(RootConfig.class, BaseConfiguration.class,
ServerPortConfig.class, EndpointWebMvcAutoConfiguration.class);
EndpointWebMvcAutoConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"ENDPOINTS_ENABLED:false");
this.applicationContext.refresh();
@ -498,7 +501,7 @@ public class EndpointWebMvcAutoConfigurationTests {
@Test
public void shutdownEndpointEnabled() {
this.applicationContext.register(RootConfig.class, BaseConfiguration.class,
ServerPortConfig.class, EndpointWebMvcAutoConfiguration.class);
EndpointWebMvcAutoConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"endpoints.shutdown.enabled:true");
this.applicationContext.refresh();
@ -509,7 +512,7 @@ public class EndpointWebMvcAutoConfigurationTests {
@Test
public void actuatorEndpointEnabledIndividually() {
this.applicationContext.register(RootConfig.class, BaseConfiguration.class,
ServerPortConfig.class, EndpointWebMvcAutoConfiguration.class);
EndpointWebMvcAutoConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"endpoints.enabled:false", "endpoints.actuator.enabled:true");
this.applicationContext.refresh();
@ -520,6 +523,7 @@ public class EndpointWebMvcAutoConfigurationTests {
@Test
public void managementSpecificSslUsingDifferentPort() throws Exception {
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"management.port=" + ports.get().management,
"management.ssl.enabled=true",
"management.ssl.key-store=classpath:test.jks",
"management.ssl.key-password=password");
@ -551,7 +555,7 @@ public class EndpointWebMvcAutoConfigurationTests {
"management.ssl.key-password=password");
this.applicationContext.register(RootConfig.class, EndpointConfig.class,
BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class,
ErrorMvcAutoConfiguration.class, ServerPortConfig.class);
ErrorMvcAutoConfiguration.class);
this.thrown.expect(IllegalStateException.class);
this.thrown.expectMessage("Management-specific SSL cannot be configured as the "
+ "management server is not listening on a separate port");
@ -561,6 +565,7 @@ public class EndpointWebMvcAutoConfigurationTests {
@Test
public void managementServerCanDisableSslWhenUsingADifferentPort() throws Exception {
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"management.port=" + ports.get().management,
"server.ssl.enabled=true", "server.ssl.key-store=classpath:test.jks",
"server.ssl.key-password=password", "management.ssl.enabled=false");
@ -586,6 +591,8 @@ public class EndpointWebMvcAutoConfigurationTests {
@Test
public void tomcatManagementAccessLogUsesCustomPrefix() throws Exception {
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"management.port=" + ports.get().management);
this.applicationContext.register(TomcatContainerConfig.class, RootConfig.class,
EndpointConfig.class, DifferentPortConfig.class, BaseConfiguration.class,
EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class);
@ -606,11 +613,12 @@ public class EndpointWebMvcAutoConfigurationTests {
@Test
public void undertowManagementAccessLogUsesCustomPrefix() throws Exception {
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"management.port=" + ports.get().management,
"server.undertow.accesslog.enabled: true");
this.applicationContext.register(UndertowContainerConfig.class, RootConfig.class,
EndpointConfig.class, DifferentPortConfig.class, BaseConfiguration.class,
EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"server.undertow.accesslog.enabled: true");
this.applicationContext.refresh();
ApplicationContext managementContext = this.applicationContext
.getBean(ManagementContextResolver.class).getApplicationContext();
@ -634,7 +642,7 @@ public class EndpointWebMvcAutoConfigurationTests {
private void endpointDisabled(String name, Class<? extends MvcEndpoint> type) {
this.applicationContext.register(RootConfig.class, BaseConfiguration.class,
ServerPortConfig.class, EndpointWebMvcAutoConfiguration.class);
EndpointWebMvcAutoConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.applicationContext,
String.format("endpoints.%s.enabled:false", name));
this.applicationContext.refresh();
@ -644,7 +652,7 @@ public class EndpointWebMvcAutoConfigurationTests {
private void endpointEnabledOverride(String name, Class<? extends MvcEndpoint> type)
throws Exception {
this.applicationContext.register(LoggingConfig.class, RootConfig.class,
BaseConfiguration.class, ServerPortConfig.class,
BaseConfiguration.class,
EndpointWebMvcAutoConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"endpoints.enabled:false",
@ -721,9 +729,9 @@ public class EndpointWebMvcAutoConfigurationTests {
private static class Ports {
int server = SocketUtils.findAvailableTcpPort();
final int server = SocketUtils.findAvailableTcpPort();
int management = SocketUtils.findAvailableTcpPort();
final int management = SocketUtils.findAvailableTcpPort();
}
@ -733,8 +741,7 @@ public class EndpointWebMvcAutoConfigurationTests {
JacksonAutoConfiguration.class, EndpointAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
ServerPropertiesAutoConfiguration.class, AuditAutoConfiguration.class })
AuditAutoConfiguration.class })
protected static class BaseConfiguration {
}
@ -769,31 +776,6 @@ public class EndpointWebMvcAutoConfigurationTests {
}
@Configuration
public static class ServerPortConfig {
private int count = 0;
public int getCount() {
return this.count;
}
@Bean
public ServerProperties serverProperties() {
ServerProperties properties = new ServerProperties() {
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
ServerPortConfig.this.count++;
super.customize(container);
}
};
properties.setPort(server.getPort());
properties.setContextPath(server.getContextPath());
return properties;
}
}
@Controller
public static class TestController {
@ -836,14 +818,8 @@ public class EndpointWebMvcAutoConfigurationTests {
}
@Configuration
@Import(ServerPortConfig.class)
public static class DifferentPortConfig {
@Bean
public ManagementServerProperties managementServerProperties() {
return management;
}
@Bean
public EndpointHandlerMappingCustomizer mappingCustomizer() {
return new EndpointHandlerMappingCustomizer() {
@ -880,33 +856,6 @@ public class EndpointWebMvcAutoConfigurationTests {
}
@Configuration
@Import(ServerPortConfig.class)
public static class RandomPortConfig {
@Bean
public ManagementServerProperties managementServerProperties() {
ManagementServerProperties properties = new ManagementServerProperties();
properties.setPort(0);
properties.getSecurity().setEnabled(false);
return properties;
}
}
@Configuration
@Import(ServerPortConfig.class)
public static class DisableConfig {
@Bean
public ManagementServerProperties managementServerProperties() {
ManagementServerProperties properties = new ManagementServerProperties();
properties.setPort(-1);
return properties;
}
}
public static class TestEndpoint implements MvcEndpoint {
@RequestMapping

@ -54,7 +54,6 @@ public class EndpointWebMvcManagementContextConfigurationTests {
WebMvcAutoConfiguration.class, JacksonAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
EndpointAutoConfiguration.class, EndpointWebMvcAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class,
WebClientAutoConfiguration.class,
EndpointWebMvcManagementContextConfiguration.class);

@ -87,7 +87,6 @@ public class HealthMvcEndpointAutoConfigurationTests {
@ImportAutoConfiguration({ SecurityAutoConfiguration.class,
JacksonAutoConfiguration.class, WebMvcAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class, AuditAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
EndpointAutoConfiguration.class, EndpointWebMvcAutoConfiguration.class })
static class TestConfiguration {

@ -72,7 +72,6 @@ public class JolokiaAutoConfigurationTests {
"jolokia.config[key2]:value2");
this.context.register(Config.class, WebMvcAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
JolokiaAutoConfiguration.class);
this.context.refresh();
@ -86,7 +85,6 @@ public class JolokiaAutoConfigurationTests {
"endpoints.jolokia.path=/foo/bar");
this.context.register(EndpointsConfig.class, WebMvcAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
JolokiaAutoConfiguration.class);
this.context.refresh();
@ -118,7 +116,6 @@ public class JolokiaAutoConfigurationTests {
EnvironmentTestUtils.addEnvironment(this.context, pairs);
this.context.register(Config.class, WebMvcAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
JolokiaAutoConfiguration.class);
this.context.refresh();
@ -130,7 +127,6 @@ public class JolokiaAutoConfigurationTests {
EnvironmentTestUtils.addEnvironment(this.context, pairs);
this.context.register(Config.class, WebMvcAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
JolokiaAutoConfiguration.class);
this.context.refresh();

@ -20,6 +20,7 @@ import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.junit.runner.classpath.ClassPathExclusions;
import org.springframework.boot.junit.runner.classpath.ModifiedClassPathRunner;
import org.springframework.boot.test.util.EnvironmentTestUtils;
@ -28,14 +29,13 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link ManagementServerPropertiesAutoConfiguration} when Spring Security is
* not present.
* Tests for {@link ManagementServerProperties} when Spring Security is not present.
*
* @author Stephane Nicoll
*/
@RunWith(ModifiedClassPathRunner.class)
@ClassPathExclusions("spring-security-*.jar")
public class ManagementServerPropertiesAutoConfigurationNoSecurityTests {
public class ManagementServerPropertiesNoSecurityTests {
private AnnotationConfigApplicationContext context;
@ -55,10 +55,16 @@ public class ManagementServerPropertiesAutoConfigurationNoSecurityTests {
public ManagementServerProperties load(String... environment) {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
EnvironmentTestUtils.addEnvironment(context, environment);
context.register(ManagementServerPropertiesAutoConfiguration.class);
context.register(Config.class);
context.refresh();
this.context = context;
return this.context.getBean(ManagementServerProperties.class);
}
@EnableConfigurationProperties(ManagementServerProperties.class)
protected static class Config {
}
}

@ -19,18 +19,19 @@ package org.springframework.boot.actuate.autoconfigure;
import org.junit.After;
import org.junit.Test;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.util.EnvironmentTestUtils;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link ManagementServerPropertiesAutoConfiguration}.
* Tests for {@link ManagementServerProperties}.
*
* @author Phillip Webb
* @author Stephane Nicoll
*/
public class ManagementServerPropertiesAutoConfigurationTests {
public class ManagementServerPropertiesTests {
private AnnotationConfigApplicationContext context;
@ -87,10 +88,15 @@ public class ManagementServerPropertiesAutoConfigurationTests {
public ManagementServerProperties load(String... environment) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
EnvironmentTestUtils.addEnvironment(ctx, environment);
ctx.register(ManagementServerPropertiesAutoConfiguration.class);
ctx.register(Config.class);
ctx.refresh();
this.context = ctx;
return this.context.getBean(ManagementServerProperties.class);
}
@EnableConfigurationProperties(ManagementServerProperties.class)
protected static class Config {
}
}

@ -90,7 +90,6 @@ public class ManagementWebSecurityAutoConfigurationTests {
JacksonAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
EndpointAutoConfiguration.class, EndpointWebMvcAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class, AuditAutoConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.context, "security.basic.enabled:false");
this.context.refresh();
@ -141,7 +140,6 @@ public class ManagementWebSecurityAutoConfigurationTests {
this.context.register(SecurityAutoConfiguration.class,
ManagementWebSecurityAutoConfiguration.class,
EndpointAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.context, "security.ignored:none");
this.context.refresh();
@ -170,7 +168,6 @@ public class ManagementWebSecurityAutoConfigurationTests {
this.context.register(TestConfiguration.class, SecurityAutoConfiguration.class,
ManagementWebSecurityAutoConfiguration.class,
EndpointAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
this.context.refresh();
assertThat(this.context.getBean(AuthenticationManager.class)).isEqualTo(
@ -184,7 +181,6 @@ public class ManagementWebSecurityAutoConfigurationTests {
this.context.register(TestConfiguration.class, SecurityAutoConfiguration.class,
ManagementWebSecurityAutoConfiguration.class,
EndpointAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
this.context.refresh();
assertThat(this.context.getBean(AuthenticationManager.class)).isEqualTo(
@ -201,7 +197,6 @@ public class ManagementWebSecurityAutoConfigurationTests {
JacksonAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
EndpointAutoConfiguration.class, EndpointWebMvcAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
WebMvcAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class,
AuditAutoConfiguration.class);
this.context.refresh();
@ -264,7 +259,6 @@ public class ManagementWebSecurityAutoConfigurationTests {
WebMvcAutoConfiguration.class, ManagementWebSecurityAutoConfiguration.class,
JacksonAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class,
EndpointAutoConfiguration.class, EndpointWebMvcAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class, AuditAutoConfiguration.class,
FallbackWebSecurityAutoConfiguration.class })
static class WebConfiguration {

@ -30,7 +30,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;
@ -44,9 +43,7 @@ import org.springframework.context.annotation.Configuration;
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Configuration
@ImportAutoConfiguration({ ServerPropertiesAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
EmbeddedServletContainerAutoConfiguration.class,
@ImportAutoConfiguration({ EmbeddedServletContainerAutoConfiguration.class,
DispatcherServletAutoConfiguration.class, JacksonAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class, WebMvcAutoConfiguration.class,
HypermediaAutoConfiguration.class, EndpointAutoConfiguration.class,

@ -51,7 +51,6 @@ import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoints;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport;
import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration;
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
import org.springframework.boot.logging.LoggingSystem;
import org.springframework.boot.test.util.EnvironmentTestUtils;
import org.springframework.context.annotation.Bean;
@ -144,9 +143,8 @@ public class MvcEndpointPathConfigurationTests {
@Configuration
@ImportAutoConfiguration({ EndpointAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
ServerPropertiesAutoConfiguration.class, AuditAutoConfiguration.class,
EndpointWebMvcAutoConfiguration.class, JolokiaAutoConfiguration.class })
AuditAutoConfiguration.class, EndpointWebMvcAutoConfiguration.class,
JolokiaAutoConfiguration.class })
protected static class TestConfiguration {

@ -26,7 +26,6 @@ import org.mockito.ArgumentCaptor;
import org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.EndpointWebMvcManagementContextConfiguration;
import org.springframework.boot.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.ManagementWebSecurityAutoConfiguration;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
@ -69,7 +68,6 @@ public class CloudFoundryActuatorAutoConfigurationTests {
JacksonAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
EndpointAutoConfiguration.class, EndpointWebMvcAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class,
WebClientAutoConfiguration.class,
EndpointWebMvcManagementContextConfiguration.class,

@ -29,7 +29,6 @@ import org.springframework.boot.actuate.audit.AuditEvent;
import org.springframework.boot.actuate.audit.AuditEventRepository;
import org.springframework.boot.actuate.audit.InMemoryAuditEventRepository;
import org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration;
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
@ -124,8 +123,7 @@ public class AuditEventsMvcEndpointTests {
@Import({ JacksonAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
EndpointWebMvcAutoConfiguration.class, WebMvcAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class })
EndpointWebMvcAutoConfiguration.class, WebMvcAutoConfiguration.class })
@Configuration
protected static class TestConfiguration {

@ -26,7 +26,6 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.autoconfigure.AuditAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration;
import org.springframework.boot.actuate.endpoint.EnvironmentEndpoint;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration;
@ -141,8 +140,7 @@ public class EnvironmentMvcEndpointTests {
@Configuration
@Import({ JacksonAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class, WebMvcAutoConfiguration.class,
EndpointWebMvcAutoConfiguration.class, AuditAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class })
EndpointWebMvcAutoConfiguration.class, AuditAutoConfiguration.class })
public static class TestConfiguration {
@Bean

@ -27,7 +27,6 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration;
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
@ -79,8 +78,7 @@ public class HeapdumpMvcEndpointSecureOptionsTests {
@Import({ JacksonAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
EndpointWebMvcAutoConfiguration.class, WebMvcAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class })
EndpointWebMvcAutoConfiguration.class, WebMvcAutoConfiguration.class })
@Configuration
public static class TestConfiguration {

@ -30,7 +30,6 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.autoconfigure.AuditAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration;
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
@ -117,8 +116,7 @@ public class HeapdumpMvcEndpointTests {
@Import({ JacksonAutoConfiguration.class, AuditAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
EndpointWebMvcAutoConfiguration.class, WebMvcAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class })
EndpointWebMvcAutoConfiguration.class, WebMvcAutoConfiguration.class })
@Configuration
public static class TestConfiguration {

@ -27,7 +27,6 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.autoconfigure.AuditAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration;
import org.springframework.boot.actuate.endpoint.InfoEndpoint;
import org.springframework.boot.actuate.info.Info;
import org.springframework.boot.actuate.info.InfoContributor;
@ -100,8 +99,7 @@ public class InfoMvcEndpointTests {
@Import({ JacksonAutoConfiguration.class, AuditAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
EndpointWebMvcAutoConfiguration.class, WebMvcAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class })
EndpointWebMvcAutoConfiguration.class, WebMvcAutoConfiguration.class })
@Configuration
public static class TestConfiguration {

@ -25,7 +25,6 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.autoconfigure.AuditAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration;
import org.springframework.boot.actuate.endpoint.InfoEndpoint;
import org.springframework.boot.actuate.info.InfoContributor;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
@ -71,8 +70,7 @@ public class InfoMvcEndpointWithNoInfoContributorsTests {
@Import({ JacksonAutoConfiguration.class, AuditAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
EndpointWebMvcAutoConfiguration.class, WebMvcAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class })
EndpointWebMvcAutoConfiguration.class, WebMvcAutoConfiguration.class })
@Configuration
public static class TestConfiguration {

@ -24,7 +24,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.autoconfigure.AuditAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.JolokiaAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration;
import org.springframework.boot.actuate.endpoint.mvc.JolokiaMvcEndpointContextPathTests.Config;
import org.springframework.boot.actuate.endpoint.mvc.JolokiaMvcEndpointContextPathTests.ContextPathListener;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
@ -88,8 +87,7 @@ public class JolokiaMvcEndpointContextPathTests {
@EnableWebMvc
@Import({ JacksonAutoConfiguration.class, AuditAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
EndpointWebMvcAutoConfiguration.class, JolokiaAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class })
EndpointWebMvcAutoConfiguration.class, JolokiaAutoConfiguration.class })
public static class Config {
}

@ -26,7 +26,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.autoconfigure.AuditAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.JolokiaAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
@ -103,8 +102,7 @@ public class JolokiaMvcEndpointIntegrationTests {
@EnableWebMvc
@Import({ JacksonAutoConfiguration.class, AuditAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
EndpointWebMvcAutoConfiguration.class, JolokiaAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class })
EndpointWebMvcAutoConfiguration.class, JolokiaAutoConfiguration.class })
public static class Config {
}

@ -27,7 +27,6 @@ import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration;
import org.springframework.boot.actuate.endpoint.LoggersEndpoint;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration;
@ -172,8 +171,7 @@ public class LoggersMvcEndpointTests {
@Configuration
@Import({ JacksonAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
EndpointWebMvcAutoConfiguration.class, WebMvcAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class })
EndpointWebMvcAutoConfiguration.class, WebMvcAutoConfiguration.class })
public static class TestConfiguration {
@Bean

@ -27,7 +27,6 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.autoconfigure.AuditAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration;
import org.springframework.boot.actuate.endpoint.MetricsEndpoint;
import org.springframework.boot.actuate.endpoint.PublicMetrics;
import org.springframework.boot.actuate.metrics.Metric;
@ -165,8 +164,7 @@ public class MetricsMvcEndpointTests {
@Import({ JacksonAutoConfiguration.class, AuditAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
EndpointWebMvcAutoConfiguration.class, WebMvcAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class })
EndpointWebMvcAutoConfiguration.class, WebMvcAutoConfiguration.class })
@Configuration
public static class TestConfiguration {

@ -23,7 +23,6 @@ import org.springframework.boot.actuate.autoconfigure.AuditAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.JolokiaAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration;
@ -56,7 +55,6 @@ public class MvcEndpointCorsIntegrationTests {
this.context.register(JacksonAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
EndpointAutoConfiguration.class, EndpointWebMvcAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class, AuditAutoConfiguration.class,
JolokiaAutoConfiguration.class, WebMvcAutoConfiguration.class);
}

@ -22,7 +22,6 @@ import org.junit.Test;
import org.springframework.boot.actuate.autoconfigure.AuditAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.ManagementWebSecurityAutoConfiguration;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
@ -231,7 +230,6 @@ public class MvcEndpointIntegrationTests {
@ImportAutoConfiguration({ JacksonAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class, EndpointAutoConfiguration.class,
EndpointWebMvcAutoConfiguration.class, AuditAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class, WebMvcAutoConfiguration.class,
AuditAutoConfiguration.class })
static class DefaultConfiguration {

@ -22,7 +22,6 @@ import org.junit.runner.RunWith;
import org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
@ -90,7 +89,6 @@ public class NoSpringSecurityHealthMvcEndpointIntegrationTests {
@ImportAutoConfiguration({ JacksonAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class, EndpointAutoConfiguration.class,
EndpointWebMvcAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class, WebMvcAutoConfiguration.class })
@Configuration
static class TestConfiguration {

@ -28,7 +28,6 @@ import org.mockito.stubbing.Answer;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration;
import org.springframework.boot.actuate.endpoint.ShutdownEndpoint;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration;
@ -96,8 +95,7 @@ public class ShutdownMvcEndpointTests {
@Configuration
@Import({ JacksonAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
EndpointWebMvcAutoConfiguration.class, WebMvcAutoConfiguration.class,
ManagementServerPropertiesAutoConfiguration.class })
EndpointWebMvcAutoConfiguration.class, WebMvcAutoConfiguration.class })
public static class TestConfiguration {
@Bean

@ -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

@ -68,7 +68,7 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
@Configuration
@ConditionalOnProperty(prefix = "spring.devtools.remote", name = "secret")
@ConditionalOnClass({ Filter.class, ServerHttpRequest.class })
@EnableConfigurationProperties(DevToolsProperties.class)
@EnableConfigurationProperties({ ServerProperties.class, DevToolsProperties.class })
public class RemoteDevToolsAutoConfiguration {
private static final Log logger = LogFactory

@ -26,7 +26,6 @@ import org.junit.rules.ExpectedException;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
import org.springframework.boot.devtools.remote.server.DispatcherFilter;
import org.springframework.boot.devtools.restart.MockRestarter;
import org.springframework.boot.devtools.restart.server.HttpRestartServer;
@ -231,8 +230,7 @@ public class RemoteDevToolsAutoConfigurationTests {
private void loadContext(String... properties) {
this.context = new AnnotationConfigWebApplicationContext();
this.context.setServletContext(new MockServletContext());
this.context.register(Config.class, ServerPropertiesAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
this.context.register(Config.class, PropertyPlaceholderAutoConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.context, properties);
this.context.refresh();
}

@ -21,8 +21,6 @@ import java.util.Map;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.SecurityProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -44,13 +42,6 @@ public class SampleActuatorUiApplication {
throw new RuntimeException("Expected exception in controller");
}
@Bean
public SecurityProperties securityProperties() {
SecurityProperties security = new SecurityProperties();
security.getBasic().setPath(""); // empty so home page is insecured
return security;
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleActuatorUiApplication.class, args);
}

@ -1 +1,4 @@
health.diskspace.enabled=false
# empty so home page is unsecured
security.basic.path=

@ -27,7 +27,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.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
@ -57,8 +56,7 @@ public class NonAutoConfigurationSampleTomcatApplicationTests {
@Configuration
@Import({ EmbeddedServletContainerAutoConfiguration.class,
DispatcherServletAutoConfiguration.class,
ServerPropertiesAutoConfiguration.class, WebMvcAutoConfiguration.class,
DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class })
@ComponentScan(basePackageClasses = { SampleController.class,

@ -18,7 +18,6 @@ package org.springframework.boot.test.autoconfigure.web.servlet;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
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;
@ -30,8 +29,7 @@ import org.springframework.context.annotation.Import;
*/
@Configuration
@ConditionalOnProperty(prefix = "spring.test.mockmvc", name = "secure", havingValue = "true", matchIfMissing = true)
@Import({ SecurityAutoConfiguration.class, ServerPropertiesAutoConfiguration.class,
MockMvcSecurityConfiguration.class })
@Import({ SecurityAutoConfiguration.class, MockMvcSecurityConfiguration.class })
public class MockMvcSecurityAutoConfiguration {
}

@ -83,7 +83,6 @@ org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration,\
org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration,\
org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration,\
org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration,\
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration,\
org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration
# DefaultTestExecutionListenersPostProcessors

Loading…
Cancel
Save