Extended PropertyPlaceholderConfigurer Object needs to resolve placeholder for itself
Hello folks,
I am writing to ask your input on how to resolve placeholders for ExtendedPropertyPlaceholderConfigurer. So I have a class which extends
Code:
public class ExtendedPropertyPlaceholderConfigurer
extends PropertyPlaceholderConfigurer {
}
In my applicationContext.xml I have it bean wired to start up with a location file:///c:/temp/startup.properties file which has only two props:
1. app.properties.url = http://myserver:8080/getProp
2. app.env.params = ?env=dev
Now at run time, I want to be able to use the two properties from above, to have a method (loadExternalProps) which makes a GET request to the ${app.properties.url} + ${app.env.params} and merges/loads the result of the GET request.
loadExternalProps() method should be called if anytime a placeholder is unresolved -- since the external_properties file may have it...
Code:
if (super.resolvePlaceholder(placeholder) == null) {
loadExternalProps();
}
but this approach is not working. but it seems that my loadExternalProps method is never called.
the startup.props file was found correctly,
2011-07-12 06:46:23,386 (PropertiesLoaderSupport.java:178) INFO example.self.ExtendedPropertyPlaceholderConfigurer[] - Loading properties file from URL [file:/C:/temp/startup.properties]
And if I put all my properties manually on the startup.properties, all placeholders in the bean wirings/and application are resolved correctly.
I would really appreciate if i can get any input or work arounds....
thank you