Skip to content

Commit eca61af

Browse files
committed
Merge pull request #8161 from izeye:clean-system-property
* pr/8161: Clear system property in SpringApplicationTests
2 parents 715f8d7 + cedc4cd commit eca61af

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,21 +130,21 @@ public void storeAndClearHeadlessProperty() {
130130

131131
@After
132132
public void reinstateHeadlessProperty() {
133-
System.clearProperty("spring.main.banner-mode");
134133
if (this.headlessProperty == null) {
135134
System.clearProperty("java.awt.headless");
136135
}
137136
else {
138137
System.setProperty("java.awt.headless", this.headlessProperty);
139138
}
140-
141139
}
142140

143141
@After
144-
public void close() {
142+
public void cleanUp() {
145143
if (this.context != null) {
146144
this.context.close();
147145
}
146+
System.clearProperty("spring.main.banner-mode");
147+
System.clearProperty(CachedIntrospectionResults.IGNORE_BEANINFO_PROPERTY_NAME);
148148
}
149149

150150
@Test

spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import org.junit.rules.ExpectedException;
3838
import org.slf4j.LoggerFactory;
3939

40-
import org.springframework.beans.CachedIntrospectionResults;
4140
import org.springframework.boot.SpringApplication;
4241
import org.springframework.boot.WebApplicationType;
4342
import org.springframework.boot.context.config.ConfigFileApplicationListener.ConfigurationPropertySources;
@@ -98,14 +97,12 @@ public void resetLogging() {
9897
}
9998

10099
@After
101-
public void cleanup() {
100+
public void cleanUp() {
102101
if (this.context != null) {
103102
this.context.close();
104103
}
105104
System.clearProperty("the.property");
106105
System.clearProperty("spring.config.location");
107-
System.clearProperty("spring.main.banner-mode");
108-
System.clearProperty(CachedIntrospectionResults.IGNORE_BEANINFO_PROPERTY_NAME);
109106
}
110107

111108
@Test

0 commit comments

Comments
 (0)