Skip to content

Commit 7243b16

Browse files
author
eugenp
committed
work on properties
1 parent 3bc0b75 commit 7243b16

12 files changed

+44
-13
lines changed

spring-all/src/main/java/org/baeldung/properties/spring/PropertiesWithJavaConfig.java renamed to spring-all/src/main/java/org/baeldung/properties/external/PropertiesWithJavaConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.baeldung.properties.spring;
1+
package org.baeldung.properties.external;
22

33
import org.springframework.context.annotation.Bean;
44
import org.springframework.context.annotation.ComponentScan;

spring-all/src/main/java/org/baeldung/properties/spring/PropertiesWithXmlConfig.java renamed to spring-all/src/main/java/org/baeldung/properties/external/PropertiesWithXmlConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.baeldung.properties.spring;
1+
package org.baeldung.properties.external;
22

33
import org.springframework.context.annotation.ComponentScan;
44
import org.springframework.context.annotation.Configuration;

spring-all/src/main/java/org/baeldung/properties/spring/PropertiesWithXmlConfigOne.java renamed to spring-all/src/main/java/org/baeldung/properties/external/PropertiesWithXmlConfigOne.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.baeldung.properties.spring;
1+
package org.baeldung.properties.external;
22

33
import org.springframework.context.annotation.ComponentScan;
44
import org.springframework.context.annotation.Configuration;

spring-all/src/main/java/org/baeldung/properties/spring/PropertiesWithXmlConfigTwo.java renamed to spring-all/src/main/java/org/baeldung/properties/external/PropertiesWithXmlConfigTwo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.baeldung.properties.spring;
1+
package org.baeldung.properties.external;
22

33
import org.springframework.context.annotation.Configuration;
44
import org.springframework.context.annotation.ImportResource;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package org.baeldung.properties.spring;
2+
3+
import org.springframework.context.annotation.Bean;
4+
import org.springframework.context.annotation.Configuration;
5+
import org.springframework.context.annotation.PropertySource;
6+
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
7+
8+
@Configuration
9+
@PropertySource("classpath:foo.properties")
10+
public class BasicPropertiesWithJavaConfig {
11+
12+
public BasicPropertiesWithJavaConfig() {
13+
super();
14+
}
15+
16+
// beans
17+
18+
@Bean
19+
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
20+
return new PropertySourcesPlaceholderConfigurer();
21+
}
22+
23+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
3+
xmlns:util="http://www.springframework.org/schema/util"
4+
xsi:schemaLocation="
5+
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
6+
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd
7+
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"
8+
>
9+
10+
<context:property-placeholder location="classpath:foo.properties" ignore-unresolvable="true" order="1"/>
11+
12+
</beans>

spring-all/src/test/java/org/baeldung/properties/core/PropertiesWithJavaIntegrationTest.java renamed to spring-all/src/test/java/org/baeldung/properties/basic/PropertiesWithJavaIntegrationTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package org.baeldung.properties.core;
1+
package org.baeldung.properties.basic;
22

3-
import org.baeldung.properties.spring.PropertiesWithJavaConfig;
3+
import org.baeldung.properties.spring.BasicPropertiesWithJavaConfig;
44
import org.baeldung.properties.spring.PropertiesWithJavaConfigOther;
55
import org.junit.Test;
66
import org.junit.runner.RunWith;
@@ -12,7 +12,7 @@
1212
import org.springframework.test.context.support.AnnotationConfigContextLoader;
1313

1414
@RunWith(SpringJUnit4ClassRunner.class)
15-
@ContextConfiguration(classes = { PropertiesWithJavaConfig.class, PropertiesWithJavaConfigOther.class }, loader = AnnotationConfigContextLoader.class)
15+
@ContextConfiguration(classes = { BasicPropertiesWithJavaConfig.class, PropertiesWithJavaConfigOther.class }, loader = AnnotationConfigContextLoader.class)
1616
public class PropertiesWithJavaIntegrationTest {
1717

1818
@Autowired

spring-all/src/test/java/org/baeldung/properties/basic/PropertiesWithMultipleXmlsIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
1010

1111
@RunWith(SpringJUnit4ClassRunner.class)
12-
@ContextConfiguration(locations = { "classpath:configForPropertiesOne.xml", "classpath:basicConfigForPropertiesTwo.xml" })
12+
@ContextConfiguration(locations = { "classpath:basicConfigForPropertiesOne.xml", "classpath:basicConfigForPropertiesTwo.xml" })
1313
public class PropertiesWithMultipleXmlsIntegrationTest {
1414

1515
@Autowired

spring-all/src/test/java/org/baeldung/properties/external/ExternalPropertiesWithJavaIntegrationTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.baeldung.properties.external;
22

3-
import org.baeldung.properties.spring.PropertiesWithJavaConfig;
43
import org.baeldung.properties.spring.PropertiesWithJavaConfigOther;
54
import org.junit.Ignore;
65
import org.junit.Test;

spring-all/src/test/java/org/baeldung/properties/external/ExternalPropertiesWithMultipleXmlsIntegrationTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package org.baeldung.properties.external;
22

3-
import org.baeldung.properties.spring.PropertiesWithXmlConfigOne;
4-
import org.baeldung.properties.spring.PropertiesWithXmlConfigTwo;
53
import org.junit.Ignore;
64
import org.junit.Test;
75
import org.junit.runner.RunWith;

0 commit comments

Comments
 (0)