I found a reasonable solution:
1) upgrade to Spring 3.1.3.RELEASE
2) Implement a Context Initializer Class:
a) create a wrapper for your properties file (mine is just a static
singleton for a PropertiesFile).
b) create SpringContextInitializer:
public class SpringContextInitializer implements
ApplicationContextInitializer<ConfigurableWebApplicationContext> {
private static final transient Logger LOG =
LoggerFactory.getLogger(SpringContextInitializer.class);
public void initialize(ConfigurableWebApplicationContext ctx) {
LOG.trace("SpringContextInitializer: initialize");
ctx.getEnvironment().getPropertySources().addFirst(new
SpringContextInitializerPropertySource("NGMSPropertiesRoute"));
}
}
c) Implement a SpringContextInitializerPropertySource:
public class SpringContextInitializerPropertySource extends
PropertySource<NGMSPropertiesRoute> {
private static final transient Logger LOG =
LoggerFactory.getLogger(SpringContextInitializerPropertySource.class);
public SpringContextInitializerPropertySource(String name) {
super(name);
}
@Override
public Object getProperty(String name) {
String val =
PropertiesFactory.getPropertiesFactory().getRouteProperties().getProperty(name,
null);
LOG.trace("Spring asked for property: {}, returning: {}", name,
val);
return val;
}
}
3) Configure the web.xml file to use your context initializer:
<context-param>
<param-name>contextInitializerClasses</param-name>
<param-value>com.mycompany.SpringContextInitializer</param-value>
</context-param>
and, now I can use property placeholder ANYWHERE - including the <import
resource="${myvariable.name}" />
The writeup on this from Spring is at:
http://blog.springsource.org/2011/02/15/spring-3-1-m1-unified-property-management/
Thanks!
--
View this message in context:
http://camel.465427.n5.nabble.com/Bridge-Property-Loading-Order-tp5722306p5722378.html
Sent from the Camel - Users mailing list archive at Nabble.com.