Skip to content

Commit

Permalink
work on properties
Browse files Browse the repository at this point in the history
  • Loading branch information
eugenp committed Aug 15, 2015
1 parent 3bc0b75 commit 7243b16
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.baeldung.properties.spring;
package org.baeldung.properties.external;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.baeldung.properties.spring;
package org.baeldung.properties.external;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.baeldung.properties.spring;
package org.baeldung.properties.external;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.baeldung.properties.spring;
package org.baeldung.properties.external;

import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.baeldung.properties.spring;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;

@Configuration
@PropertySource("classpath:foo.properties")
public class BasicPropertiesWithJavaConfig {

public BasicPropertiesWithJavaConfig() {
super();
}

// beans

@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
}

}
12 changes: 12 additions & 0 deletions spring-all/src/main/resources/basicConfigForPropertiesOne.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<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"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"
>

<context:property-placeholder location="classpath:foo.properties" ignore-unresolvable="true" order="1"/>

</beans>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.baeldung.properties.core;
package org.baeldung.properties.basic;

import org.baeldung.properties.spring.PropertiesWithJavaConfig;
import org.baeldung.properties.spring.BasicPropertiesWithJavaConfig;
import org.baeldung.properties.spring.PropertiesWithJavaConfigOther;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -12,7 +12,7 @@
import org.springframework.test.context.support.AnnotationConfigContextLoader;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { PropertiesWithJavaConfig.class, PropertiesWithJavaConfigOther.class }, loader = AnnotationConfigContextLoader.class)
@ContextConfiguration(classes = { BasicPropertiesWithJavaConfig.class, PropertiesWithJavaConfigOther.class }, loader = AnnotationConfigContextLoader.class)
public class PropertiesWithJavaIntegrationTest {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:configForPropertiesOne.xml", "classpath:basicConfigForPropertiesTwo.xml" })
@ContextConfiguration(locations = { "classpath:basicConfigForPropertiesOne.xml", "classpath:basicConfigForPropertiesTwo.xml" })
public class PropertiesWithMultipleXmlsIntegrationTest {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.baeldung.properties.external;

import org.baeldung.properties.spring.PropertiesWithJavaConfig;
import org.baeldung.properties.spring.PropertiesWithJavaConfigOther;
import org.junit.Ignore;
import org.junit.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.baeldung.properties.external;

import org.baeldung.properties.spring.PropertiesWithXmlConfigOne;
import org.baeldung.properties.spring.PropertiesWithXmlConfigTwo;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.baeldung.properties.external;

import org.baeldung.properties.spring.PropertiesWithXmlConfig;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.baeldung.test;

import org.baeldung.properties.basic.PropertiesWithJavaIntegrationTest;
import org.baeldung.properties.basic.PropertiesWithMultipleXmlsIntegrationTest;
import org.baeldung.properties.basic.PropertiesWithXmlIntegrationTest;
import org.baeldung.properties.core.PropertiesWithJavaIntegrationTest;
import org.baeldung.properties.external.ExternalPropertiesWithJavaIntegrationTest;
import org.baeldung.properties.external.ExternalPropertiesWithMultipleXmlsIntegrationTest;
import org.baeldung.properties.external.ExternalPropertiesWithXmlIntegrationTest;
Expand Down

0 comments on commit 7243b16

Please sign in to comment.