diff --git a/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java b/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java index f5a5664e29..441a6fdc0a 100644 --- a/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java +++ b/spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java @@ -36,7 +36,6 @@ import org.springframework.beans.factory.ObjectFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; -import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; import org.springframework.beans.factory.config.Scope; import org.springframework.beans.factory.config.TypedStringValue; import org.springframework.beans.factory.support.AutowireCandidateQualifier; @@ -66,13 +65,14 @@ import static org.springframework.tests.TestGroup.PERFORMANCE; * @author Sam Brannen * @since 3.0 */ -public class ApplicationContextExpressionTests { +class ApplicationContextExpressionTests { private static final Log factoryLog = LogFactory.getLog(DefaultListableBeanFactory.class); @Test - public void genericApplicationContext() throws Exception { + @SuppressWarnings("deprecation") + void genericApplicationContext() throws Exception { GenericApplicationContext ac = new GenericApplicationContext(); AnnotationConfigUtils.registerAnnotationConfigProcessors(ac); @@ -105,7 +105,8 @@ public class ApplicationContextExpressionTests { ac.getBeanFactory().setConversionService(new DefaultConversionService()); - PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer(); + org.springframework.beans.factory.config.PropertyPlaceholderConfigurer ppc = + new org.springframework.beans.factory.config.PropertyPlaceholderConfigurer(); Properties placeholders = new Properties(); placeholders.setProperty("code", "123"); ppc.setProperties(placeholders); @@ -211,7 +212,7 @@ public class ApplicationContextExpressionTests { } @Test - public void prototypeCreationReevaluatesExpressions() { + void prototypeCreationReevaluatesExpressions() { GenericApplicationContext ac = new GenericApplicationContext(); AnnotationConfigUtils.registerAnnotationConfigProcessors(ac); GenericConversionService cs = new GenericConversionService(); @@ -247,7 +248,7 @@ public class ApplicationContextExpressionTests { @Test @EnabledForTestGroups(PERFORMANCE) - public void prototypeCreationIsFastEnough() { + void prototypeCreationIsFastEnough() { Assume.notLogging(factoryLog); GenericApplicationContext ac = new GenericApplicationContext(); RootBeanDefinition rbd = new RootBeanDefinition(TestBean.class); @@ -273,10 +274,11 @@ public class ApplicationContextExpressionTests { System.getProperties().remove("name"); } assertThat(sw.getTotalTimeMillis() < 6000).as("Prototype creation took too long: " + sw.getTotalTimeMillis()).isTrue(); + ac.close(); } @Test - public void systemPropertiesSecurityManager() { + void systemPropertiesSecurityManager() { AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext(); GenericBeanDefinition bd = new GenericBeanDefinition(); @@ -309,10 +311,11 @@ public class ApplicationContextExpressionTests { System.setSecurityManager(oldSecurityManager); System.getProperties().remove("country"); } + ac.close(); } @Test - public void stringConcatenationWithDebugLogging() { + void stringConcatenationWithDebugLogging() { AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext(); GenericBeanDefinition bd = new GenericBeanDefinition(); @@ -323,10 +326,11 @@ public class ApplicationContextExpressionTests { String str = ac.getBean("str", String.class); assertThat(str.startsWith("test-")).isTrue(); + ac.close(); } @Test - public void resourceInjection() throws IOException { + void resourceInjection() throws IOException { System.setProperty("logfile", "do_not_delete_me.txt"); try (AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext(ResourceInjectionBean.class)) { ResourceInjectionBean resourceInjectionBean = ac.getBean(ResourceInjectionBean.class);