From 6d14fc66c7c874098180bc02763260b67c74ec53 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Fri, 27 Mar 2015 14:11:19 +0200 Subject: [PATCH] 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 --- .../integration/config/IntegrationRegistrar.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/IntegrationRegistrar.java b/spring-integration-core/src/main/java/org/springframework/integration/config/IntegrationRegistrar.java index e87716fe5c..e43e8afd60 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/IntegrationRegistrar.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/IntegrationRegistrar.java @@ -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");