Browse Source

Delete unnecessary PropertySourcesPlaceholderConfigurer beans

Issue: SPR-14140
pull/1369/head
Sam Brannen 9 years ago
parent
commit
0f0aa46e49
  1. 9
      spring-test/src/test/java/org/springframework/test/context/env/InlinedPropertiesOverridePropertiesFilesTestPropertySourceTests.java
  2. 8
      spring-test/src/test/java/org/springframework/test/context/junit/jupiter/TestConfig.java
  3. 10
      spring-test/src/test/java/org/springframework/test/context/junit4/aci/annotation/PropertySourcesInitializerTests.java

9
spring-test/src/test/java/org/springframework/test/context/env/InlinedPropertiesOverridePropertiesFilesTestPropertySourceTests.java vendored

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2016 the original author or authors. * Copyright 2002-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -21,9 +21,7 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.TestPropertySource;
@ -59,11 +57,6 @@ public class InlinedPropertiesOverridePropertiesFilesTestPropertySourceTests {
@Configuration @Configuration
static class Config { static class Config {
@Bean
public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
}
} }
} }

8
spring-test/src/test/java/org/springframework/test/context/junit/jupiter/TestConfig.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2016 the original author or authors. * Copyright 2002-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -19,7 +19,6 @@ package org.springframework.test.context.junit.jupiter;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Primary;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.test.context.junit.jupiter.comics.Cat; import org.springframework.test.context.junit.jupiter.comics.Cat;
import org.springframework.test.context.junit.jupiter.comics.Dog; import org.springframework.test.context.junit.jupiter.comics.Dog;
import org.springframework.test.context.junit.jupiter.comics.Person; import org.springframework.test.context.junit.jupiter.comics.Person;
@ -33,11 +32,6 @@ import org.springframework.test.context.junit.jupiter.comics.Person;
@Configuration @Configuration
public class TestConfig { public class TestConfig {
@Bean
static PropertySourcesPlaceholderConfigurer placeholderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
}
@Bean @Bean
Person dilbert() { Person dilbert() {
return new Person("Dilbert"); return new Person("Dilbert");

10
spring-test/src/test/java/org/springframework/test/context/junit4/aci/annotation/PropertySourcesInitializerTests.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2014 the original author or authors. * Copyright 2002-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -25,7 +25,6 @@ import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.env.PropertySource; import org.springframework.core.env.PropertySource;
import org.springframework.mock.env.MockPropertySource; import org.springframework.mock.env.MockPropertySource;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
@ -48,8 +47,7 @@ public class PropertySourcesInitializerTests {
static class Config { static class Config {
@Value("${enigma}") @Value("${enigma}")
// If the PropertySourcesPlaceholderConfigurer is not configured as a // The following can also be used to directly access the
// static @Bean, then the following can be used to directly access the
// environment instead of relying on placeholder replacement. // environment instead of relying on placeholder replacement.
// @Value("#{ environment['enigma'] }") // @Value("#{ environment['enigma'] }")
private String enigma; private String enigma;
@ -60,10 +58,6 @@ public class PropertySourcesInitializerTests {
return enigma; return enigma;
} }
@Bean
public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
}
} }

Loading…
Cancel
Save