Clear system property in SpringApplicationTests

See gh-8101
Closes gh-8161
This commit is contained in:
Johnny Lim
2017-02-01 10:37:03 +09:00
committed by Stephane Nicoll
parent 715f8d7436
commit cedc4cd9f4
2 changed files with 4 additions and 7 deletions

View File

@@ -130,21 +130,21 @@ public class SpringApplicationTests {
@After
public void reinstateHeadlessProperty() {
System.clearProperty("spring.main.banner-mode");
if (this.headlessProperty == null) {
System.clearProperty("java.awt.headless");
}
else {
System.setProperty("java.awt.headless", this.headlessProperty);
}
}
@After
public void close() {
public void cleanUp() {
if (this.context != null) {
this.context.close();
}
System.clearProperty("spring.main.banner-mode");
System.clearProperty(CachedIntrospectionResults.IGNORE_BEANINFO_PROPERTY_NAME);
}
@Test

View File

@@ -37,7 +37,6 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.slf4j.LoggerFactory;
import org.springframework.beans.CachedIntrospectionResults;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.context.config.ConfigFileApplicationListener.ConfigurationPropertySources;
@@ -98,14 +97,12 @@ public class ConfigFileApplicationListenerTests {
}
@After
public void cleanup() {
public void cleanUp() {
if (this.context != null) {
this.context.close();
}
System.clearProperty("the.property");
System.clearProperty("spring.config.location");
System.clearProperty("spring.main.banner-mode");
System.clearProperty(CachedIntrospectionResults.IGNORE_BEANINFO_PROPERTY_NAME);
}
@Test