I need to override a property value given in my property file while loading my JBOSS Application server.
I tried out with below code overriding processProperties() method in PropertyPlaceholderConfigurer.
My property file has this entry
base.url="defaultUrl"
public class CustomPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer {
protected String convertPropertyValue(String originalValue) {
return (originalValue != null) ? originalValue.trim() : originalValue;
}
@Override
protected void processProperties(ConfigurableListableBeanFactory beanFactory, Properties props)
throws BeansException {
super.processProperties(beanFactory, props);
for (Enumeration names = props.propertyNames(); names.hasMoreElements();) {
String key = (String) names.nextElement();
props.put("base.url", getUpdatedUrl());
}
}
}
I am injecting base.url value in a placeholder ${base.url} in application context.
How should I update the value of given property in run time. The above code always take the value in the property file not the updated value.