diff --git a/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/properties/core/ComponentInXmlUsingProperties.java b/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/properties/core/ComponentInXmlUsingProperties.java deleted file mode 100644 index 675c72e642..0000000000 --- a/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/properties/core/ComponentInXmlUsingProperties.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.baeldung.properties.core; - -import org.springframework.beans.factory.InitializingBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.core.env.Environment; - -public class ComponentInXmlUsingProperties implements InitializingBean { - - @Autowired - private Environment env; - - @Value("${key.something}") - private String injectedProperty; - - public ComponentInXmlUsingProperties(final String propertyValue) { - super(); - - System.out.println("Constructor Injection - Property Value resolved to: " + propertyValue); - } - - // - - @Override - public void afterPropertiesSet() throws Exception { - System.out.println("in afterPropertiesSet via @Value: " + injectedProperty); - System.out.println("in afterPropertiesSet Environment: " + env.getProperty("key.something")); - } - -} diff --git a/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/properties/external/ExternalPropertiesWithXmlConfig.java b/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/properties/external/ExternalPropertiesWithXmlConfig.java deleted file mode 100644 index 9080e3d0ba..0000000000 --- a/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/properties/external/ExternalPropertiesWithXmlConfig.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.properties.external; - -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.ImportResource; - -@Configuration -@ImportResource("classpath:configForProperties.xml") -@ComponentScan("com.baeldung.core") -public class ExternalPropertiesWithXmlConfig { - - public ExternalPropertiesWithXmlConfig() { - super(); - } - -} \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/properties/external/ExternalPropertiesWithXmlConfigOne.java b/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/properties/external/ExternalPropertiesWithXmlConfigOne.java deleted file mode 100644 index f45f5b6a03..0000000000 --- a/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/properties/external/ExternalPropertiesWithXmlConfigOne.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.properties.external; - -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.ImportResource; - -@Configuration -@ImportResource("classpath:configForPropertiesOne.xml") -@ComponentScan("com.baeldung.core") -public class ExternalPropertiesWithXmlConfigOne { - - public ExternalPropertiesWithXmlConfigOne() { - super(); - } - -} \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/properties/external/ExternalPropertiesWithXmlConfigTwo.java b/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/properties/external/ExternalPropertiesWithXmlConfigTwo.java deleted file mode 100644 index 38ecdd2aae..0000000000 --- a/spring-boot-modules/spring-boot-properties/src/main/java/com/baeldung/properties/external/ExternalPropertiesWithXmlConfigTwo.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.properties.external; - -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.ImportResource; - -@Configuration -@ImportResource("classpath:basicConfigForPropertiesTwo.xml") -public class ExternalPropertiesWithXmlConfigTwo { - - public ExternalPropertiesWithXmlConfigTwo() { - super(); - } - -} \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-properties/src/main/resources/basicConfigForProperties.xml b/spring-boot-modules/spring-boot-properties/src/main/resources/basicConfigForProperties.xml deleted file mode 100644 index e50de084f0..0000000000 --- a/spring-boot-modules/spring-boot-properties/src/main/resources/basicConfigForProperties.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-properties/src/main/resources/basicConfigForPropertiesOne.xml b/spring-boot-modules/spring-boot-properties/src/main/resources/basicConfigForPropertiesOne.xml deleted file mode 100644 index 01b297d437..0000000000 --- a/spring-boot-modules/spring-boot-properties/src/main/resources/basicConfigForPropertiesOne.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-properties/src/main/resources/basicConfigForPropertiesTwo.xml b/spring-boot-modules/spring-boot-properties/src/main/resources/basicConfigForPropertiesTwo.xml deleted file mode 100644 index 1d470c4340..0000000000 --- a/spring-boot-modules/spring-boot-properties/src/main/resources/basicConfigForPropertiesTwo.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-properties/src/main/resources/configForDbProperties.xml b/spring-boot-modules/spring-boot-properties/src/main/resources/configForDbProperties.xml deleted file mode 100644 index 00fd5f0508..0000000000 --- a/spring-boot-modules/spring-boot-properties/src/main/resources/configForDbProperties.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-properties/src/main/resources/configForProperties.xml b/spring-boot-modules/spring-boot-properties/src/main/resources/configForProperties.xml deleted file mode 100644 index 16db00ace3..0000000000 --- a/spring-boot-modules/spring-boot-properties/src/main/resources/configForProperties.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-properties/src/main/resources/configForPropertiesOne.xml b/spring-boot-modules/spring-boot-properties/src/main/resources/configForPropertiesOne.xml deleted file mode 100644 index 53072d89bb..0000000000 --- a/spring-boot-modules/spring-boot-properties/src/main/resources/configForPropertiesOne.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-properties/src/main/resources/configForPropertyPlaceholderBeans.xml b/spring-boot-modules/spring-boot-properties/src/main/resources/configForPropertyPlaceholderBeans.xml deleted file mode 100644 index fd2731df36..0000000000 --- a/spring-boot-modules/spring-boot-properties/src/main/resources/configForPropertyPlaceholderBeans.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - classpath:foo.properties - - - - - \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/properties/basic/PropertiesWithMultipleXmlsIntegrationTest.java b/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/properties/basic/PropertiesWithMultipleXmlsIntegrationTest.java deleted file mode 100644 index c3af2dc1d8..0000000000 --- a/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/properties/basic/PropertiesWithMultipleXmlsIntegrationTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.properties.basic; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.core.env.Environment; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { "classpath:basicConfigForPropertiesOne.xml", "classpath:basicConfigForPropertiesTwo.xml" }) -public class PropertiesWithMultipleXmlsIntegrationTest { - - @Autowired - private Environment env; - - @Value("${key.something}") - private String injectedProperty; - - @Test - public final void givenContextIsInitialized_thenNoException() { - System.out.println("in test via @Value: " + injectedProperty); - System.out.println("in test Environment: " + env.getProperty("key.something")); - } - -} diff --git a/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/properties/basic/PropertiesWithXmlIntegrationTest.java b/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/properties/basic/PropertiesWithXmlIntegrationTest.java deleted file mode 100644 index 85c4ac34e2..0000000000 --- a/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/properties/basic/PropertiesWithXmlIntegrationTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.properties.basic; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.core.env.Environment; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = "classpath:basicConfigForProperties.xml") -public class PropertiesWithXmlIntegrationTest { - - @Autowired - private Environment env; - - @Value("${key.something}") - private String injectedProperty; - - @Test - public final void givenContextIsInitialized_thenNoException() { - System.out.println("in test via @Value: " + injectedProperty); - System.out.println("in test Environment: " + env.getProperty("key.something")); - } - -} diff --git a/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/properties/external/ExternalPropertiesWithMultipleXmlsIntegrationTest.java b/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/properties/external/ExternalPropertiesWithMultipleXmlsIntegrationTest.java deleted file mode 100644 index 018c655ec2..0000000000 --- a/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/properties/external/ExternalPropertiesWithMultipleXmlsIntegrationTest.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.baeldung.properties.external; - -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.core.env.Environment; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import com.baeldung.properties.external.ExternalPropertiesWithXmlConfigOne; -import com.baeldung.properties.external.ExternalPropertiesWithXmlConfigTwo; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { ExternalPropertiesWithXmlConfigOne.class, ExternalPropertiesWithXmlConfigTwo.class }, loader = AnnotationConfigContextLoader.class) -@Ignore("manual only") -public class ExternalPropertiesWithMultipleXmlsIntegrationTest { - - @Autowired - private Environment env; - - @Value("${key.something}") - private String injectedProperty; - - @Value("${external.something}") - private String injectedExternalProperty; - - @Test - public final void givenContextIsInitialized_thenNoException() { - System.out.println("in test via @Value: " + injectedProperty); - System.out.println("in test Environment: " + env.getProperty("key.something")); - - System.out.println("in test via @Value - external: " + injectedExternalProperty); - System.out.println("in test Environment - external: " + env.getProperty("external.something")); - } - -} diff --git a/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/properties/external/ExternalPropertiesWithXmlManualTest.java b/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/properties/external/ExternalPropertiesWithXmlManualTest.java deleted file mode 100644 index 4f0abbc12c..0000000000 --- a/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/properties/external/ExternalPropertiesWithXmlManualTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.baeldung.properties.external; - -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.core.env.Environment; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import com.baeldung.properties.external.ExternalPropertiesWithXmlConfig; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { ExternalPropertiesWithXmlConfig.class }, loader = AnnotationConfigContextLoader.class) -@Ignore("manual only") -public class ExternalPropertiesWithXmlManualTest { - - @Autowired - private Environment env; - - @Value("${key.something}") - private String injectedProperty; - - @Value("${external.something}") - private String injectedExternalProperty; - - @Test - public final void givenContextIsInitialized_thenNoException() { - System.out.println("in test via @Value: " + injectedProperty); - System.out.println("in test Environment: " + env.getProperty("key.something")); - - System.out.println("in test via @Value - external: " + injectedExternalProperty); - System.out.println("in test Environment - external: " + env.getProperty("external.something")); - } - -} diff --git a/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/properties/multiple/MultiplePlaceholdersXmlConfigIntegrationTest.java b/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/properties/multiple/MultiplePlaceholdersXmlConfigIntegrationTest.java deleted file mode 100644 index b863e2e080..0000000000 --- a/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/properties/multiple/MultiplePlaceholdersXmlConfigIntegrationTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.baeldung.properties.multiple; - -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; - -import static org.assertj.core.api.Assertions.assertThat; - - -@SpringJUnitConfig(locations = "classpath:configForPropertyPlaceholderBeans.xml") -public class MultiplePlaceholdersXmlConfigIntegrationTest { - - @Value("${foo}") - private String something; - - @Value("${key.something}") - private String something2; - - - @Test - public void whenReadInjectedValues_thenGetCorrectValues() { - assertThat(something).isEqualTo("bar"); - assertThat(something2).isEqualTo("val"); - } -} \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/properties/multiple/MultiplePropertiesXmlConfigIntegrationTest.java b/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/properties/multiple/MultiplePropertiesXmlConfigIntegrationTest.java deleted file mode 100644 index 2150d4b3ec..0000000000 --- a/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/properties/multiple/MultiplePropertiesXmlConfigIntegrationTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.baeldung.properties.multiple; - -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; - -import static org.assertj.core.api.Assertions.assertThat; - -@SpringJUnitConfig(locations = {"classpath:configForProperties.xml", "classpath:configForDbProperties.xml"}) -public class MultiplePropertiesXmlConfigIntegrationTest { - - @Value("${key.something}") private String something; - - @Value("${key.something2}") private String something2; - - @Value("${jdbc.url}") private String jdbcUrl; - - @Test - public void whenReadInjectedValues_thenGetCorrectValues() { - assertThat(something).isEqualTo("val"); - assertThat(something2).isEqualTo("val2"); - assertThat(jdbcUrl).isEqualTo("jdbc:postgresql:/localhost:5432"); - } -} diff --git a/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/test/IntegrationTestSuite.java b/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/test/IntegrationTestSuite.java index 0e0f8f6230..9a1eccb439 100644 --- a/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/test/IntegrationTestSuite.java +++ b/spring-boot-modules/spring-boot-properties/src/test/java/com/baeldung/test/IntegrationTestSuite.java @@ -5,22 +5,12 @@ import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; import com.baeldung.properties.basic.ExtendedPropertiesWithJavaIntegrationTest; -import com.baeldung.properties.basic.PropertiesWithMultipleXmlsIntegrationTest; -import com.baeldung.properties.basic.PropertiesWithXmlIntegrationTest; import com.baeldung.properties.external.ExternalPropertiesWithJavaIntegrationTest; -import com.baeldung.properties.external.ExternalPropertiesWithMultipleXmlsIntegrationTest; -import com.baeldung.properties.external.ExternalPropertiesWithXmlManualTest; -import com.baeldung.properties.multiple.MultiplePropertiesXmlConfigIntegrationTest; -import com.baeldung.properties.multiple.MultiplePlaceholdersXmlConfigIntegrationTest; @RunWith(Suite.class) @SuiteClasses({ //@formatter:off - PropertiesWithXmlIntegrationTest.class, ExternalPropertiesWithJavaIntegrationTest.class, - ExternalPropertiesWithMultipleXmlsIntegrationTest.class, - ExternalPropertiesWithXmlManualTest.class, - ExtendedPropertiesWithJavaIntegrationTest.class, MultiplePropertiesXmlConfigIntegrationTest.class, - PropertiesWithMultipleXmlsIntegrationTest.class, MultiplePlaceholdersXmlConfigIntegrationTest.class + ExtendedPropertiesWithJavaIntegrationTest.class, })// @formatter:on public final class IntegrationTestSuite { //