Skip to content

Instantly share code, notes, and snippets.

@chriswhitcombe
Created September 10, 2013 15:07
Show Gist options
  • Save chriswhitcombe/6510808 to your computer and use it in GitHub Desktop.
Save chriswhitcombe/6510808 to your computer and use it in GitHub Desktop.
Sample code to load archaius properties statically via spring
public class ArchaiusPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer {
@Override
protected String resolvePlaceholder(String placeholder, Properties props, int systemPropertiesMode) {
return DynamicPropertyFactory.getInstance().getStringProperty(placeholder, "null").get();
}
}
<!-- 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