INT-3624: Register #jsonPath Only for 0.9.1

JIRA: https://jira.spring.io/browse/INT-3624

Add assert to the `IntegrationRegistrar` for the `#jsonPath` that we register this SpEL function only for support old `json-path` version

Polishing
This commit is contained in:
Artem Bilan
2015-03-27 14:11:19 +02:00
committed by Gary Russell
parent 9037c15d78
commit 6d14fc66c7

View File

@@ -216,10 +216,24 @@ public class IntegrationRegistrar implements ImportBeanDefinitionRegistrar, Bean
jsonPathClass = ClassUtils.forName("com.jayway.jsonpath.JsonPath", this.classLoader);
}
catch (ClassNotFoundException e) {
logger.debug("SpEL function '#jsonPath' isn't registered: " +
logger.debug("The '#jsonPath' SpEL function cannot be registered: " +
"there is no jayway json-path.jar on the classpath.");
}
if (jsonPathClass != null) {
try {
ClassUtils.forName("com.jayway.jsonpath.Predicate", this.classLoader);
logger.warn("The '#jsonPath' SpEL function cannot be registered. " +
"The version of json-path found on the classpath is not supported. " +
"Supported json-path version is '0.9.1'. " +
"Upgrade to Spring Integration 4.2 or later to use json-path 1.0 or later.");
jsonPathClass = null;
}
catch (ClassNotFoundException e) {
//No-op
}
}
if (jsonPathClass != null) {
IntegrationConfigUtils.registerSpelFunctionBean(registry, jsonPathBeanName,
IntegrationConfigUtils.BASE_PACKAGE + ".json.JsonPathUtils", "evaluate");