diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/AtomikosJtaConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/AtomikosJtaConfiguration.java index 01bce191e0..ed3cf1b169 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/AtomikosJtaConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/AtomikosJtaConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -28,7 +28,6 @@ import com.atomikos.icatch.config.UserTransactionServiceImp; import com.atomikos.icatch.jta.UserTransactionManager; import org.springframework.beans.factory.ObjectProvider; -import org.springframework.boot.ApplicationHome; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.transaction.TransactionManagerCustomizers; @@ -39,6 +38,7 @@ import org.springframework.boot.jta.atomikos.AtomikosDependsOnBeanFactoryPostPro import org.springframework.boot.jta.atomikos.AtomikosProperties; import org.springframework.boot.jta.atomikos.AtomikosXAConnectionFactoryWrapper; import org.springframework.boot.jta.atomikos.AtomikosXADataSourceWrapper; +import org.springframework.boot.system.ApplicationHome; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.transaction.PlatformTransactionManager; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/BitronixJtaConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/BitronixJtaConfiguration.java index 4f38acc09f..4e26fefd2b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/BitronixJtaConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/BitronixJtaConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -26,7 +26,6 @@ import bitronix.tm.TransactionManagerServices; import bitronix.tm.jndi.BitronixContext; import org.springframework.beans.factory.ObjectProvider; -import org.springframework.boot.ApplicationHome; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.transaction.TransactionManagerCustomizers; @@ -37,6 +36,7 @@ import org.springframework.boot.jta.XADataSourceWrapper; import org.springframework.boot.jta.bitronix.BitronixDependentBeanFactoryPostProcessor; import org.springframework.boot.jta.bitronix.BitronixXAConnectionFactoryWrapper; import org.springframework.boot.jta.bitronix.BitronixXADataSourceWrapper; +import org.springframework.boot.system.ApplicationHome; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.transaction.PlatformTransactionManager; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/NarayanaJtaConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/NarayanaJtaConfiguration.java index 2e645a9fcf..616b4f2293 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/NarayanaJtaConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/NarayanaJtaConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -28,7 +28,6 @@ import org.jboss.narayana.jta.jms.TransactionHelper; import org.jboss.tm.XAResourceRecoveryRegistry; import org.springframework.beans.factory.ObjectProvider; -import org.springframework.boot.ApplicationHome; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.transaction.TransactionManagerCustomizers; @@ -41,6 +40,7 @@ import org.springframework.boot.jta.narayana.NarayanaProperties; import org.springframework.boot.jta.narayana.NarayanaRecoveryManagerBean; import org.springframework.boot.jta.narayana.NarayanaXAConnectionFactoryWrapper; import org.springframework.boot.jta.narayana.NarayanaXADataSourceWrapper; +import org.springframework.boot.system.ApplicationHome; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.DependsOn; diff --git a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTesterSpringApplication.java b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTesterSpringApplication.java index dcf024da9f..32d5f5784b 100644 --- a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTesterSpringApplication.java +++ b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/CliTesterSpringApplication.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -17,7 +17,7 @@ package org.springframework.boot.cli; import org.springframework.boot.SpringApplication; -import org.springframework.boot.system.EmbeddedServerPortFileWriter; +import org.springframework.boot.web.context.WebServerPortFileWriter; import org.springframework.context.ConfigurableApplicationContext; /** @@ -33,7 +33,7 @@ public class CliTesterSpringApplication extends SpringApplication { @Override protected void postProcessApplicationContext(ConfigurableApplicationContext context) { - context.addApplicationListener(new EmbeddedServerPortFileWriter()); + context.addApplicationListener(new WebServerPortFileWriter()); } } diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc index 01ba3bb3d3..3d56a29c28 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc @@ -1337,8 +1337,8 @@ useful for process monitoring: * `ApplicationPidFileWriter` creates a file containing the application PID (by default, in the application directory with a file name of `application.pid`). -* `EmbeddedServerPortFileWriter` creates a file (or files) containing the ports of the -embedded server (by default, in the application directory with a file name of +* `WebServerPortFileWriter` creates a file (or files) containing the ports of the +running web server (by default, in the application directory with a file name of `application.port`). By default, these writers are not activated, but you can enable: diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/StartupInfoLogger.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/StartupInfoLogger.java index 2389572eaa..87510564be 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/StartupInfoLogger.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/StartupInfoLogger.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -22,6 +22,8 @@ import java.util.concurrent.Callable; import org.apache.commons.logging.Log; +import org.springframework.boot.system.ApplicationHome; +import org.springframework.boot.system.ApplicationPid; import org.springframework.context.ApplicationContext; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPidFileWriter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/ApplicationPidFileWriter.java similarity index 98% rename from spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPidFileWriter.java rename to spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/ApplicationPidFileWriter.java index 667fa15470..b83e3b5631 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPidFileWriter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/ApplicationPidFileWriter.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.system; +package org.springframework.boot.context; import java.io.File; import java.io.IOException; @@ -26,11 +26,11 @@ import java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.springframework.boot.ApplicationPid; import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent; import org.springframework.boot.context.event.ApplicationPreparedEvent; import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.boot.context.event.SpringApplicationEvent; +import org.springframework.boot.system.ApplicationPid; import org.springframework.boot.system.SystemProperties; import org.springframework.context.ApplicationListener; import org.springframework.core.Ordered; @@ -58,7 +58,7 @@ import org.springframework.util.Assert; * @author Phillip Webb * @author Tomasz Przybyla * @author Madhura Bhave - * @since 1.4.0 + * @since 2.0.0 */ public class ApplicationPidFileWriter implements ApplicationListener, Ordered { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystemProperties.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystemProperties.java index 4c14720141..86d27022e0 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystemProperties.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystemProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -16,7 +16,7 @@ package org.springframework.boot.logging; -import org.springframework.boot.ApplicationPid; +import org.springframework.boot.system.ApplicationPid; import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.Environment; import org.springframework.core.env.PropertyResolver; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ApplicationHome.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationHome.java similarity index 97% rename from spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ApplicationHome.java rename to spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationHome.java index 91d62616de..0e70dee354 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ApplicationHome.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationHome.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot; +package org.springframework.boot.system; import java.io.File; import java.io.IOException; @@ -37,7 +37,7 @@ import org.springframework.util.StringUtils; * * @author Phillip Webb * @author Raja Kolli - * @since 1.2.0 + * @since 2.0.0 */ public class ApplicationHome { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ApplicationPid.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPid.java similarity index 96% rename from spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ApplicationPid.java rename to spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPid.java index 287ba63129..765e430cf7 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ApplicationPid.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPid.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot; +package org.springframework.boot.system; import java.io.File; import java.io.FileNotFoundException; @@ -32,6 +32,7 @@ import org.springframework.util.ObjectUtils; * An application process ID. * * @author Phillip Webb + * @since 2.0.0 */ public class ApplicationPid { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ApplicationTemp.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationTemp.java similarity index 97% rename from spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ApplicationTemp.java rename to spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationTemp.java index ade842fcf8..8301c4f8d8 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ApplicationTemp.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationTemp.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot; +package org.springframework.boot.system; import java.io.File; import java.security.MessageDigest; @@ -28,7 +28,7 @@ import org.springframework.util.StringUtils; * restarting an application will give the same location. * * @author Phillip Webb - * @since 1.3.0 + * @since 2.0.0 */ public class ApplicationTemp { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/SystemProperties.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/SystemProperties.java index 908b3ad1c9..3ae58829cc 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/SystemProperties.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/SystemProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -20,8 +20,9 @@ package org.springframework.boot.system; * Access to system properties. * * @author Phillip Webb + * @since 2.0.0 */ -final class SystemProperties { +public final class SystemProperties { private SystemProperties() { } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/EmbeddedServerPortFileWriter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/context/WebServerPortFileWriter.java similarity index 84% rename from spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/EmbeddedServerPortFileWriter.java rename to spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/context/WebServerPortFileWriter.java index bd3468d1c1..0722ad190e 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/EmbeddedServerPortFileWriter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/context/WebServerPortFileWriter.java @@ -14,15 +14,14 @@ * limitations under the License. */ -package org.springframework.boot.system; +package org.springframework.boot.web.context; import java.io.File; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.springframework.boot.web.context.WebServerApplicationContext; -import org.springframework.boot.web.context.WebServerInitializedEvent; +import org.springframework.boot.system.SystemProperties; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationListener; import org.springframework.util.Assert; @@ -38,42 +37,40 @@ import org.springframework.util.StringUtils; * @author David Liu * @author Phillip Webb * @author Andy Wilkinson - * @since 1.4.0 + * @since 2.0.0 */ -public class EmbeddedServerPortFileWriter +public class WebServerPortFileWriter implements ApplicationListener { private static final String DEFAULT_FILE_NAME = "application.port"; private static final String[] PROPERTY_VARIABLES = { "PORTFILE", "portfile" }; - private static final Log logger = LogFactory - .getLog(EmbeddedServerPortFileWriter.class); + private static final Log logger = LogFactory.getLog(WebServerPortFileWriter.class); private final File file; /** - * Create a new {@link EmbeddedServerPortFileWriter} instance using the filename + * Create a new {@link WebServerPortFileWriter} instance using the filename * 'application.port'. */ - public EmbeddedServerPortFileWriter() { + public WebServerPortFileWriter() { this(new File(DEFAULT_FILE_NAME)); } /** - * Create a new {@link EmbeddedServerPortFileWriter} instance with a specified - * filename. + * Create a new {@link WebServerPortFileWriter} instance with a specified filename. * @param filename the name of file containing port */ - public EmbeddedServerPortFileWriter(String filename) { + public WebServerPortFileWriter(String filename) { this(new File(filename)); } /** - * Create a new {@link EmbeddedServerPortFileWriter} instance with a specified file. + * Create a new {@link WebServerPortFileWriter} instance with a specified file. * @param file the file containing port */ - public EmbeddedServerPortFileWriter(File file) { + public WebServerPortFileWriter(File file) { Assert.notNull(file, "File must not be null"); String override = SystemProperties.get(PROPERTY_VARIABLES); if (override != null) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/SessionStoreDirectory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/SessionStoreDirectory.java index ee5d87a017..98ab0e626e 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/SessionStoreDirectory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/SessionStoreDirectory.java @@ -18,8 +18,8 @@ package org.springframework.boot.web.servlet.server; import java.io.File; -import org.springframework.boot.ApplicationHome; -import org.springframework.boot.ApplicationTemp; +import org.springframework.boot.system.ApplicationHome; +import org.springframework.boot.system.ApplicationTemp; import org.springframework.util.Assert; /** diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/system/ApplicationPidFileWriterTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/ApplicationPidFileWriterTests.java similarity index 98% rename from spring-boot-project/spring-boot/src/test/java/org/springframework/boot/system/ApplicationPidFileWriterTests.java rename to spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/ApplicationPidFileWriterTests.java index 272cd54cbf..3ff1760dbf 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/system/ApplicationPidFileWriterTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/ApplicationPidFileWriterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.system; +package org.springframework.boot.context; import java.io.File; import java.io.FileReader; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/logging/LoggingApplicationListenerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/logging/LoggingApplicationListenerTests.java index 76f9667156..18ce4d9b81 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/logging/LoggingApplicationListenerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/logging/LoggingApplicationListenerTests.java @@ -38,7 +38,6 @@ import org.junit.rules.TemporaryFolder; import org.junit.runner.RunWith; import org.slf4j.bridge.SLF4JBridgeHandler; -import org.springframework.boot.ApplicationPid; import org.springframework.boot.SpringApplication; import org.springframework.boot.context.event.ApplicationFailedEvent; import org.springframework.boot.context.event.ApplicationStartingEvent; @@ -51,6 +50,7 @@ import org.springframework.boot.logging.LoggingInitializationContext; import org.springframework.boot.logging.LoggingSystem; import org.springframework.boot.logging.LoggingSystemProperties; import org.springframework.boot.logging.java.JavaLoggingSystem; +import org.springframework.boot.system.ApplicationPid; import org.springframework.boot.testsupport.rule.OutputCapture; import org.springframework.boot.testsupport.runner.classpath.ClassPathExclusions; import org.springframework.boot.testsupport.runner.classpath.ModifiedClassPathRunner; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ApplicationPidTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/system/ApplicationPidTests.java similarity index 96% rename from spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ApplicationPidTests.java rename to spring-boot-project/spring-boot/src/test/java/org/springframework/boot/system/ApplicationPidTests.java index f8243935a1..28aaf71161 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ApplicationPidTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/system/ApplicationPidTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot; +package org.springframework.boot.system; import java.io.File; import java.io.FileReader; @@ -24,7 +24,6 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; -import org.springframework.boot.ApplicationPid; import org.springframework.util.FileCopyUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ApplicationTempTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/system/ApplicationTempTests.java similarity index 94% rename from spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ApplicationTempTests.java rename to spring-boot-project/spring-boot/src/test/java/org/springframework/boot/system/ApplicationTempTests.java index 6dec17ff41..fa242352cb 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/ApplicationTempTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/system/ApplicationTempTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot; +package org.springframework.boot.system; import java.io.File; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/system/EmbeddedServerPortFileWriterTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/context/WebServerPortFileWriterTest.java similarity index 87% rename from spring-boot-project/spring-boot/src/test/java/org/springframework/boot/system/EmbeddedServerPortFileWriterTests.java rename to spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/context/WebServerPortFileWriterTest.java index f25eda2571..11a8a29f3c 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/system/EmbeddedServerPortFileWriterTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/context/WebServerPortFileWriterTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.system; +package org.springframework.boot.web.context; import java.io.File; import java.io.FileReader; @@ -27,8 +27,6 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.springframework.boot.web.context.WebServerApplicationContext; -import org.springframework.boot.web.context.WebServerInitializedEvent; import org.springframework.boot.web.server.WebServer; import org.springframework.util.FileCopyUtils; import org.springframework.util.StringUtils; @@ -38,13 +36,13 @@ import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; /** - * Tests {@link EmbeddedServerPortFileWriter}. + * Tests {@link WebServerPortFileWriter}. * * @author David Liu * @author Phillip Webb * @author Andy Wilkinson */ -public class EmbeddedServerPortFileWriterTests { +public class WebServerPortFileWriterTest { @Rule public final TemporaryFolder temporaryFolder = new TemporaryFolder(); @@ -58,7 +56,7 @@ public class EmbeddedServerPortFileWriterTests { @Test public void createPortFile() throws Exception { File file = this.temporaryFolder.newFile(); - EmbeddedServerPortFileWriter listener = new EmbeddedServerPortFileWriter(file); + WebServerPortFileWriter listener = new WebServerPortFileWriter(file); listener.onApplicationEvent(mockEvent("", 8080)); assertThat(FileCopyUtils.copyToString(new FileReader(file))).isEqualTo("8080"); } @@ -66,7 +64,7 @@ public class EmbeddedServerPortFileWriterTests { @Test public void overridePortFileWithDefault() throws Exception { System.setProperty("PORTFILE", this.temporaryFolder.newFile().getAbsolutePath()); - EmbeddedServerPortFileWriter listener = new EmbeddedServerPortFileWriter(); + WebServerPortFileWriter listener = new WebServerPortFileWriter(); listener.onApplicationEvent(mockEvent("", 8080)); FileReader reader = new FileReader(System.getProperty("PORTFILE")); assertThat(FileCopyUtils.copyToString(reader)).isEqualTo("8080"); @@ -76,7 +74,7 @@ public class EmbeddedServerPortFileWriterTests { public void overridePortFileWithExplicitFile() throws Exception { File file = this.temporaryFolder.newFile(); System.setProperty("PORTFILE", this.temporaryFolder.newFile().getAbsolutePath()); - EmbeddedServerPortFileWriter listener = new EmbeddedServerPortFileWriter(file); + WebServerPortFileWriter listener = new WebServerPortFileWriter(file); listener.onApplicationEvent(mockEvent("", 8080)); FileReader reader = new FileReader(System.getProperty("PORTFILE")); assertThat(FileCopyUtils.copyToString(reader)).isEqualTo("8080"); @@ -85,7 +83,7 @@ public class EmbeddedServerPortFileWriterTests { @Test public void createManagementPortFile() throws Exception { File file = this.temporaryFolder.newFile(); - EmbeddedServerPortFileWriter listener = new EmbeddedServerPortFileWriter(file); + WebServerPortFileWriter listener = new WebServerPortFileWriter(file); listener.onApplicationEvent(mockEvent("", 8080)); listener.onApplicationEvent(mockEvent("management", 9090)); assertThat(FileCopyUtils.copyToString(new FileReader(file))).isEqualTo("8080"); @@ -104,7 +102,7 @@ public class EmbeddedServerPortFileWriterTests { public void createUpperCaseManagementPortFile() throws Exception { File file = this.temporaryFolder.newFile(); file = new File(file.getParentFile(), file.getName().toUpperCase()); - EmbeddedServerPortFileWriter listener = new EmbeddedServerPortFileWriter(file); + WebServerPortFileWriter listener = new WebServerPortFileWriter(file); listener.onApplicationEvent(mockEvent("management", 9090)); String managementFile = file.getName(); managementFile = managementFile.substring(0, managementFile.length() diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java index f5d51b7220..bd422f1113 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java @@ -86,8 +86,8 @@ import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; import org.mockito.InOrder; -import org.springframework.boot.ApplicationHome; -import org.springframework.boot.ApplicationTemp; +import org.springframework.boot.system.ApplicationHome; +import org.springframework.boot.system.ApplicationTemp; import org.springframework.boot.testsupport.rule.OutputCapture; import org.springframework.boot.testsupport.web.servlet.ExampleFilter; import org.springframework.boot.testsupport.web.servlet.ExampleServlet; diff --git a/spring-boot-tests/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/com/example/DevToolsTestApplication.java b/spring-boot-tests/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/com/example/DevToolsTestApplication.java index dc29f1f9b3..98f989b070 100644 --- a/spring-boot-tests/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/com/example/DevToolsTestApplication.java +++ b/spring-boot-tests/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/com/example/DevToolsTestApplication.java @@ -18,14 +18,14 @@ package com.example; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.boot.web.context.EmbeddedServerPortFileWriter; +import org.springframework.boot.web.context.WebServerPortFileWriter; @SpringBootApplication public class DevToolsTestApplication { public static void main(String[] args) { new SpringApplicationBuilder(DevToolsTestApplication.class) - .listeners(new EmbeddedServerPortFileWriter("target/server.port")) + .listeners(new WebServerPortFileWriter("target/server.port")) .run(args); } diff --git a/spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/test/java/com/example/ResourceHandlingApplication.java b/spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/test/java/com/example/ResourceHandlingApplication.java index 31b64317e2..e78b09fd1c 100644 --- a/spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/test/java/com/example/ResourceHandlingApplication.java +++ b/spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/test/java/com/example/ResourceHandlingApplication.java @@ -26,7 +26,7 @@ import javax.servlet.http.HttpServletResponse; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.boot.web.context.EmbeddedServerPortFileWriter; +import org.springframework.boot.web.context.WebServerPortFileWriter; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; @@ -41,7 +41,7 @@ public class ResourceHandlingApplication { public static void main(String[] args) { new SpringApplicationBuilder(ResourceHandlingApplication.class) .properties("server.port:0") - .listeners(new EmbeddedServerPortFileWriter("target/server.port")) + .listeners(new WebServerPortFileWriter("target/server.port")) .run(args); }