After a migration of the spring framework to 4.2.8 (since version 4.1.6), I can’t load the configuration via custom PropertyPlaceholder.
<bean id="customPlaceHolderConfigurer" class="xxx.CustomPlaceHolderConfigurer">
<property name="order" value="#{T(org.springframework.core.Ordered).HIGHEST_PRECEDENCE + 10}" />
<property name="ignoreUnresolvablePlaceholders" value="true" />
</bean>
<jaxws:client id="wsBusinessService" address="${pf:WS_URL}/soap/ws" serviceClass="xxx.WSBusinessService" />
And CustomPlaceholder
public class CustomPlaceHolderConfigurer extends PropertyPlaceholderConfigurer {
private static final Logger LOGGER = LoggerFactory.getLogger(CustomPlaceHolderConfigurer.class);
@Override
protected String resolvePlaceholder(final String pPlaceholder, final Properties pProps) {
String value = null;
if (pPlaceholder != null) {
if (CIStringUtils.startsWith(pPlaceholder, "pf")) {
String propertyKey = StringUtils.substring(pPlaceholder, 3);
if (propertyKey.contains(":")) {
String defaultValue = StringUtils.substringAfter(propertyKey, ":");
String newKey = StringUtils.substringBefore(propertyKey, ":");
value = Plateforme.getProperty(newKey, defaultValue);
} else {
value = Plateforme.getProperty(propertyKey);
}
}
}
LOGGER.debug("placeholder '{}' resolved to '{}'", pPlaceholder, value);
return value;
}
}
When I start the application, I get the following log:
2016-12-13T15:52:12,448 [localhost-startStop-2] DEBUG CustomPlaceHolderConfigurer - placeholder 'pf:WS_URL' resolved to 'services.com'
but an exception was throwed by jaxws because the property was not replaced : « Could not find conduit initiator for address: ${pf:WS_URL}/soap/ws and transport: http://schemas.xmlsoap.org/soap/http »
I understood that the load order of the configuration was changed to spring 4.2.x, but I was unable to operate even by changing the order. (https://github.com/spring-projects/spring-framework/wiki/Migrating-to-Spring-Framework-4.x)
Spring Framework 4.2 comes with significant fine-tuning in configuration class processing. There may be subtle differences in the order of registration compared to 4.1; however, those are considered fixes of behavior that wasn't well-defined previously. If you are relying on a specific order, e.g. for overriding beans by name, please consider using 4.2's new facilities, in particular @Order annotations on config classes.
I tried :
#{T(org.springframework.core.Ordered).HIGHEST_PRECEDENCE + 10}
#{T(org.springframework.core.Ordered).HIGHEST_PRECEDENCE}
-1
1
Has anyone encountered this problem?
Thanks