diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ActuatorAutoConfiguration.java b/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ActuatorAutoConfiguration.java
index 9ac62fd167..1783b858e2 100644
--- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ActuatorAutoConfiguration.java
+++ b/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ActuatorAutoConfiguration.java
@@ -18,7 +18,6 @@ package org.springframework.bootstrap.actuate.autoconfigure;
import org.springframework.bootstrap.actuate.properties.EndpointsProperties;
import org.springframework.bootstrap.actuate.properties.ManagementServerProperties;
-import org.springframework.bootstrap.actuate.properties.ServerProperties;
import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean;
import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration;
import org.springframework.bootstrap.context.annotation.EnableConfigurationProperties;
@@ -42,8 +41,7 @@ public class ActuatorAutoConfiguration {
* ServerProperties has to be declared in a non-conditional bean, so that it gets
* added to the context early enough
*/
- @EnableConfigurationProperties({ ServerProperties.class,
- ManagementServerProperties.class })
+ @EnableConfigurationProperties(ManagementServerProperties.class)
public static class ServerPropertiesConfiguration {
@Bean
diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementConfiguration.java b/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementConfiguration.java
index 76359e1432..3312845b7c 100644
--- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementConfiguration.java
+++ b/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ManagementConfiguration.java
@@ -19,9 +19,9 @@ import org.springframework.beans.BeansException;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.bootstrap.actuate.properties.ManagementServerProperties;
-import org.springframework.bootstrap.actuate.properties.ServerProperties;
import org.springframework.bootstrap.context.annotation.ConditionalOnExpression;
import org.springframework.bootstrap.context.embedded.AnnotationConfigEmbeddedWebApplicationContext;
+import org.springframework.bootstrap.properties.ServerProperties;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ApplicationListener;
diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ServerConfiguration.java b/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ServerConfiguration.java
index e6b4cf7ce8..e6062267bb 100644
--- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ServerConfiguration.java
+++ b/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/autoconfigure/ServerConfiguration.java
@@ -18,41 +18,26 @@ package org.springframework.bootstrap.actuate.autoconfigure;
import javax.servlet.Servlet;
-import org.apache.catalina.valves.AccessLogValve;
-import org.apache.catalina.valves.RemoteIpValve;
-import org.springframework.beans.factory.BeanFactory;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.bootstrap.actuate.endpoint.error.ErrorEndpoint;
-import org.springframework.bootstrap.actuate.properties.ServerProperties;
-import org.springframework.bootstrap.actuate.properties.ServerProperties.Tomcat;
import org.springframework.bootstrap.context.annotation.ConditionalOnClass;
import org.springframework.bootstrap.context.embedded.ConfigurableEmbeddedServletContainerFactory;
import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.bootstrap.context.embedded.ErrorPage;
-import org.springframework.bootstrap.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
-import org.springframework.core.annotation.Order;
-import org.springframework.util.StringUtils;
/**
* Configuration for injecting externalized properties into the container (e.g. tomcat).
*
* @author Dave Syer
*/
-// Slight hack here (BeanPostProcessor), to force the server properties to be bound in
-// the right order
@Configuration
@ConditionalOnClass({ Servlet.class })
-@Order(Integer.MIN_VALUE)
@Import(InfoConfiguration.class)
public class ServerConfiguration implements EmbeddedServletContainerCustomizer {
- @Autowired
- private BeanFactory beanFactory;
-
@Value("${endpoints.error.path:/error}")
private String errorPath = "/error";
@@ -63,48 +48,7 @@ public class ServerConfiguration implements EmbeddedServletContainerCustomizer {
@Override
public void customize(ConfigurableEmbeddedServletContainerFactory factory) {
-
- // Need to do a look up here to make it lazy
- ServerProperties server = this.beanFactory.getBean(ServerProperties.class);
-
- factory.setPort(server.getPort());
- factory.setAddress(server.getAddress());
- factory.setContextPath(server.getContextPath());
-
- if (factory instanceof TomcatEmbeddedServletContainerFactory) {
- configureTomcat((TomcatEmbeddedServletContainerFactory) factory, server);
- }
-
factory.addErrorPages(new ErrorPage(this.errorPath));
-
- }
-
- private void configureTomcat(TomcatEmbeddedServletContainerFactory tomcatFactory,
- ServerProperties configuration) {
-
- Tomcat tomcat = configuration.getTomcat();
- if (tomcat.getBasedir() != null) {
- tomcatFactory.setBaseDirectory(tomcat.getBasedir());
- }
-
- String remoteIpHeader = tomcat.getRemoteIpHeader();
- String protocolHeader = tomcat.getProtocolHeader();
-
- if (StringUtils.hasText(remoteIpHeader) || StringUtils.hasText(protocolHeader)) {
- RemoteIpValve valve = new RemoteIpValve();
- valve.setRemoteIpHeader(remoteIpHeader);
- valve.setProtocolHeader(protocolHeader);
- tomcatFactory.addContextValves(valve);
- }
-
- String pattern = tomcat.getAccessLogPattern();
- if (pattern != null) {
- AccessLogValve valve = new AccessLogValve();
- valve.setPattern(pattern);
- valve.setSuffix(".log");
- tomcatFactory.addContextValves(valve);
- }
-
}
}
diff --git a/spring-bootstrap/pom.xml b/spring-bootstrap/pom.xml
index 94b45b3691..d20ddf08a5 100644
--- a/spring-bootstrap/pom.xml
+++ b/spring-bootstrap/pom.xml
@@ -141,12 +141,6 @@
hsqldb
test
-
- javax.validation
- validation-api
- 1.0.0.GA
- test
-
org.springframework
spring-test
diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/PropertyPlaceholderAutoConfiguration.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/PropertyPlaceholderAutoConfiguration.java
index d784bf6ba9..5f89f78397 100644
--- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/PropertyPlaceholderAutoConfiguration.java
+++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/PropertyPlaceholderAutoConfiguration.java
@@ -16,7 +16,6 @@
package org.springframework.bootstrap.autoconfigure;
-import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean;
import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
@@ -28,9 +27,9 @@ import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
* {@link PropertySourcesPlaceholderConfigurer}.
*
* @author Phillip Webb
+ * @author Dave Syer
*/
@Configuration
-@ConditionalOnMissingBean(PropertySourcesPlaceholderConfigurer.class)
public class PropertyPlaceholderAutoConfiguration {
@Bean
diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedJettyAutoConfiguration.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedContainerConfiguration.java
similarity index 55%
rename from spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedJettyAutoConfiguration.java
rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedContainerConfiguration.java
index e9a50bbbb4..627f26e473 100644
--- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedJettyAutoConfiguration.java
+++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedContainerConfiguration.java
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.springframework.bootstrap.autoconfigure.web;
import javax.servlet.Servlet;
+import org.apache.catalina.startup.Tomcat;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.Loader;
import org.springframework.bootstrap.context.annotation.ConditionalOnClass;
@@ -25,23 +25,43 @@ import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean
import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration;
import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerFactory;
import org.springframework.bootstrap.context.embedded.jetty.JettyEmbeddedServletContainerFactory;
+import org.springframework.bootstrap.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Import;
/**
- * {@link EnableAutoConfiguration Auto-configuration} for
- * {@link JettyEmbeddedServletContainerFactory}.
+ * {@link EnableAutoConfiguration Auto-configuration} for an embedded servlet container.
*
* @author Phillip Webb
+ * @author Dave Syer
+ *
*/
-@Configuration
-@ConditionalOnClass({ Servlet.class, Server.class, Loader.class })
-@ConditionalOnMissingBean(EmbeddedServletContainerFactory.class)
-public class EmbeddedJettyAutoConfiguration {
-
- @Bean
- public JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory() {
- return new JettyEmbeddedServletContainerFactory();
+@Import(ServerPropertiesConfiguration.class)
+public class EmbeddedContainerConfiguration {
+
+ @Configuration
+ @ConditionalOnClass({ Servlet.class, Server.class, Loader.class })
+ @ConditionalOnMissingBean(EmbeddedServletContainerFactory.class)
+ protected static class EmbeddedJettyAutoConfiguration {
+
+ @Bean
+ public JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory() {
+ return new JettyEmbeddedServletContainerFactory();
+ }
+
+ }
+
+ @Configuration
+ @ConditionalOnClass({ Servlet.class, Tomcat.class })
+ @ConditionalOnMissingBean(EmbeddedServletContainerFactory.class)
+ protected static class EmbeddedTomcatAutoConfiguration {
+
+ @Bean
+ public TomcatEmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory() {
+ return new TomcatEmbeddedServletContainerFactory();
+ }
+
}
}
diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedContainerCustomizerConfiguration.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedContainerCustomizerConfiguration.java
index 963d692e9c..b75a99f0cf 100644
--- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedContainerCustomizerConfiguration.java
+++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedContainerCustomizerConfiguration.java
@@ -43,7 +43,7 @@ import org.springframework.core.annotation.AnnotationAwareOrderComparator;
* @author Dave Syer
*/
@Configuration
-@ConditionalOnClass({ Servlet.class })
+@ConditionalOnClass({ Servlet.class, EmbeddedServletContainerCustomizer.class })
public class EmbeddedContainerCustomizerConfiguration {
@Autowired(required = false)
diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedTomcatAutoConfiguration.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedTomcatAutoConfiguration.java
deleted file mode 100644
index cdd8ea9866..0000000000
--- a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/EmbeddedTomcatAutoConfiguration.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2012-2013 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.bootstrap.autoconfigure.web;
-
-import javax.servlet.Servlet;
-
-import org.apache.catalina.startup.Tomcat;
-import org.springframework.bootstrap.context.annotation.ConditionalOnClass;
-import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean;
-import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration;
-import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerFactory;
-import org.springframework.bootstrap.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * {@link EnableAutoConfiguration Auto-configuration} for
- * {@link TomcatEmbeddedServletContainerFactory}.
- *
- * @author Phillip Webb
- */
-@Configuration
-@ConditionalOnClass({ Servlet.class, Tomcat.class })
-@ConditionalOnMissingBean(EmbeddedServletContainerFactory.class)
-public class EmbeddedTomcatAutoConfiguration {
-
- @Bean
- public TomcatEmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory() {
- return new TomcatEmbeddedServletContainerFactory();
- }
-
-}
diff --git a/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesConfiguration.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesConfiguration.java
new file mode 100644
index 0000000000..6641d00895
--- /dev/null
+++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesConfiguration.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2012-2013 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.bootstrap.autoconfigure.web;
+
+import org.apache.catalina.valves.AccessLogValve;
+import org.apache.catalina.valves.RemoteIpValve;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.bootstrap.context.annotation.EnableConfigurationProperties;
+import org.springframework.bootstrap.context.embedded.ConfigurableEmbeddedServletContainerFactory;
+import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerCustomizer;
+import org.springframework.bootstrap.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
+import org.springframework.bootstrap.properties.ServerProperties;
+import org.springframework.bootstrap.properties.ServerProperties.Tomcat;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.util.StringUtils;
+
+/**
+ * @author Dave Syer
+ *
+ */
+@Configuration
+@EnableConfigurationProperties(ServerProperties.class)
+public class ServerPropertiesConfiguration implements EmbeddedServletContainerCustomizer {
+
+ @Autowired
+ private BeanFactory beanFactory;
+
+ @Override
+ public void customize(ConfigurableEmbeddedServletContainerFactory factory) {
+
+ // Need to do a look up here to make it lazy
+ ServerProperties server = this.beanFactory.getBean(ServerProperties.class);
+
+ factory.setPort(server.getPort());
+ factory.setAddress(server.getAddress());
+ factory.setContextPath(server.getContextPath());
+
+ if (factory instanceof TomcatEmbeddedServletContainerFactory) {
+ configureTomcat((TomcatEmbeddedServletContainerFactory) factory, server);
+ }
+
+ }
+
+ private void configureTomcat(TomcatEmbeddedServletContainerFactory tomcatFactory,
+ ServerProperties configuration) {
+
+ Tomcat tomcat = configuration.getTomcat();
+ if (tomcat.getBasedir() != null) {
+ tomcatFactory.setBaseDirectory(tomcat.getBasedir());
+ }
+
+ String remoteIpHeader = tomcat.getRemoteIpHeader();
+ String protocolHeader = tomcat.getProtocolHeader();
+
+ if (StringUtils.hasText(remoteIpHeader) || StringUtils.hasText(protocolHeader)) {
+ RemoteIpValve valve = new RemoteIpValve();
+ valve.setRemoteIpHeader(remoteIpHeader);
+ valve.setProtocolHeader(protocolHeader);
+ tomcatFactory.addContextValves(valve);
+ }
+
+ String pattern = tomcat.getAccessLogPattern();
+ if (pattern != null) {
+ AccessLogValve valve = new AccessLogValve();
+ valve.setPattern(pattern);
+ valve.setSuffix(".log");
+ tomcatFactory.addContextValves(valve);
+ }
+
+ }
+
+}
diff --git a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/ServerProperties.java b/spring-bootstrap/src/main/java/org/springframework/bootstrap/properties/ServerProperties.java
similarity index 97%
rename from spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/ServerProperties.java
rename to spring-bootstrap/src/main/java/org/springframework/bootstrap/properties/ServerProperties.java
index 13f5a9bc4c..5efa8fd58e 100644
--- a/spring-bootstrap-actuator/src/main/java/org/springframework/bootstrap/actuate/properties/ServerProperties.java
+++ b/spring-bootstrap/src/main/java/org/springframework/bootstrap/properties/ServerProperties.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.bootstrap.actuate.properties;
+package org.springframework.bootstrap.properties;
import java.io.File;
import java.net.InetAddress;
diff --git a/spring-bootstrap/src/main/resources/META-INF/spring.factories b/spring-bootstrap/src/main/resources/META-INF/spring.factories
index d2e8106887..287dc31897 100644
--- a/spring-bootstrap/src/main/resources/META-INF/spring.factories
+++ b/spring-bootstrap/src/main/resources/META-INF/spring.factories
@@ -7,9 +7,8 @@ org.springframework.bootstrap.autoconfigure.data.JpaRepositoriesAutoConfiguratio
org.springframework.bootstrap.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration,\
org.springframework.bootstrap.autoconfigure.batch.BatchAutoConfiguration,\
org.springframework.bootstrap.autoconfigure.thymeleaf.ThymeleafAutoConfiguration,\
+org.springframework.bootstrap.autoconfigure.web.EmbeddedContainerConfiguration,\
org.springframework.bootstrap.autoconfigure.web.EmbeddedContainerCustomizerConfiguration,\
-org.springframework.bootstrap.autoconfigure.web.EmbeddedJettyAutoConfiguration,\
-org.springframework.bootstrap.autoconfigure.web.EmbeddedTomcatAutoConfiguration,\
org.springframework.bootstrap.autoconfigure.web.WebMvcAutoConfiguration
org.springframework.context.ApplicationContextInitializer=\
org.springframework.bootstrap.context.initializer.ConfigFileApplicationContextInitializer,\
diff --git a/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesConfigurationTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesConfigurationTests.java
new file mode 100644
index 0000000000..b9d6f295f0
--- /dev/null
+++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/autoconfigure/web/ServerPropertiesConfigurationTests.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2012-2013 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.bootstrap.autoconfigure.web;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.springframework.bootstrap.autoconfigure.PropertyPlaceholderAutoConfiguration;
+import org.springframework.bootstrap.context.embedded.AnnotationConfigEmbeddedWebApplicationContext;
+import org.springframework.bootstrap.context.embedded.ConfigurableEmbeddedServletContainerFactory;
+import org.springframework.bootstrap.context.embedded.EmbeddedServletContainerFactory;
+import org.springframework.bootstrap.properties.ServerProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.env.MapPropertySource;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * @author Dave Syer
+ *
+ */
+public class ServerPropertiesConfigurationTests {
+
+ private static ConfigurableEmbeddedServletContainerFactory containerFactory;
+
+ private AnnotationConfigEmbeddedWebApplicationContext context;
+
+ private Map environment = new HashMap();
+
+ @Before
+ public void init() {
+ containerFactory = Mockito
+ .mock(ConfigurableEmbeddedServletContainerFactory.class);
+ }
+
+ @Test
+ public void createFromConfigClass() throws Exception {
+ this.context = new AnnotationConfigEmbeddedWebApplicationContext();
+ this.context.register(EmbeddedContainerConfiguration.class,
+ ServerPropertiesConfiguration.class,
+ PropertyPlaceholderAutoConfiguration.class);
+ this.environment.put("server.port", "9000");
+ this.context.getEnvironment().getPropertySources()
+ .addFirst(new MapPropertySource("test", this.environment));
+ this.context.refresh();
+ ServerProperties server = this.context.getBean(ServerProperties.class);
+ assertNotNull(server);
+ assertEquals(9000, server.getPort());
+ }
+
+ @Configuration
+ protected static class EmbeddedContainerConfiguration {
+
+ @Bean
+ public EmbeddedServletContainerFactory containerFactory() {
+ return ServerPropertiesConfigurationTests.containerFactory;
+ }
+
+ }
+
+}
diff --git a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/properties/ServerPropertiesTests.java b/spring-bootstrap/src/test/java/org/springframework/bootstrap/properties/ServerPropertiesTests.java
similarity index 96%
rename from spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/properties/ServerPropertiesTests.java
rename to spring-bootstrap/src/test/java/org/springframework/bootstrap/properties/ServerPropertiesTests.java
index 975583ba07..2cde04b9cd 100644
--- a/spring-bootstrap-actuator/src/test/java/org/springframework/bootstrap/actuate/properties/ServerPropertiesTests.java
+++ b/spring-bootstrap/src/test/java/org/springframework/bootstrap/properties/ServerPropertiesTests.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.bootstrap.actuate.properties;
+package org.springframework.bootstrap.properties;
import java.net.InetAddress;
import java.util.Collections;
@@ -27,7 +27,7 @@ import static org.junit.Assert.assertFalse;
/**
* Externalized configuration for server properties
- *
+ *
* @author Dave Syer
*/
public class ServerPropertiesTests {