Created
September 10, 2013 15:07
-
-
Save chriswhitcombe/6510808 to your computer and use it in GitHub Desktop.
Sample code to load archaius properties statically via spring
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ArchaiusPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer { | |
@Override | |
protected String resolvePlaceholder(String placeholder, Properties props, int systemPropertiesMode) { | |
return DynamicPropertyFactory.getInstance().getStringProperty(placeholder, "null").get(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Config loading via Spring-Archaius--> | |
<bean class="com.chriswhitcombe.springarchaius.ArchaiusPropertyPlaceholderConfigurer"/> | |
<!-- Test Bean --> | |
<bean id="customer" class="com.chriswhitcombe.springarchaius.Customer"> | |
<property name="firstName" value="${customer.firstname}" /> | |
<property name="lastName" value="${customer.lastname}" /> | |
</bean> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment