This is an automated email from the ASF dual-hosted git repository.
Croway pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
The following commit(s) were added to refs/heads/main by this push:
new c9cab8e3e2b CAMEL-22857: camel-spring-boot - use json-path 3.0.0 while
on Spring Boot 4.1
c9cab8e3e2b is described below
commit c9cab8e3e2b33accf12dfd07012168672b9e92c9
Author: croway <[email protected]>
AuthorDate: Thu Nov 12 13:09:53 2026 +0100
CAMEL-22857: camel-spring-boot - use json-path 3.0.0 while on Spring Boot
4.1
Since CAMEL-22857 camel-jsonpath uses the Jackson3JsonProvider and
Jackson3MappingProvider of json-path 3.0.0. Spring Boot 4.1 manages
json-path 2.10.0, which it only uses in spring-boot-starter-test, and that
version won in the starters, so the JSONPath tests failed with
NoClassDefFoundError: com/jayway/jsonpath/spi/json/Jackson3JsonProvider.
camel-spring-boot-dependencies now manages json-path with the Camel
version, as it already does for Avro. Remove it when upgrading to Spring
Boot 4.2, which manages json-path 3.0.0.
JsonPathMapTransformTest parses its input with the Jackson 3 providers,
because camel-jsonpath no longer brings Jackson 2.
The Jackson page documents how applications on Spring Boot 4.1 select
json-path 3.0.0, since the Spring Boot dependency management wins over
the Camel BOMs there.
---
.../springboot/test/JsonPathMapTransformTest.java | 8 +++---
docs/spring-boot/modules/ROOT/pages/jackson.adoc | 30 ++++++++++++++++++++++
.../pom.xml | 9 +++++++
tooling/camel-spring-boot-dependencies/pom.xml | 5 ++++
4 files changed, 48 insertions(+), 4 deletions(-)
diff --git
a/components-starter/camel-jsonpath-starter/src/test/java/org/apache/camel/component/jsonpath/springboot/test/JsonPathMapTransformTest.java
b/components-starter/camel-jsonpath-starter/src/test/java/org/apache/camel/component/jsonpath/springboot/test/JsonPathMapTransformTest.java
index 2b001852bb6..879f659b3fb 100644
---
a/components-starter/camel-jsonpath-starter/src/test/java/org/apache/camel/component/jsonpath/springboot/test/JsonPathMapTransformTest.java
+++
b/components-starter/camel-jsonpath-starter/src/test/java/org/apache/camel/component/jsonpath/springboot/test/JsonPathMapTransformTest.java
@@ -23,8 +23,8 @@ import java.util.List;
import java.util.Map;
import com.jayway.jsonpath.Configuration;
-import com.jayway.jsonpath.spi.json.JacksonJsonProvider;
-import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider;
+import com.jayway.jsonpath.spi.json.Jackson3JsonProvider;
+import com.jayway.jsonpath.spi.mapper.Jackson3MappingProvider;
import org.apache.camel.EndpointInject;
import org.apache.camel.ProducerTemplate;
@@ -59,8 +59,8 @@ public class JsonPathMapTransformTest {
// should be a map
Configuration.ConfigurationBuilder builder = Configuration.builder();
- builder.jsonProvider(new JacksonJsonProvider());
- builder.mappingProvider(new JacksonMappingProvider());
+ builder.jsonProvider(new Jackson3JsonProvider());
+ builder.mappingProvider(new Jackson3MappingProvider());
Object document = builder.build().jsonProvider().parse(new
FileInputStream("src/test/resources/books.json"),
"utf-8");
assertIsInstanceOf(Map.class, document);
diff --git a/docs/spring-boot/modules/ROOT/pages/jackson.adoc
b/docs/spring-boot/modules/ROOT/pages/jackson.adoc
index 21bbf09dc12..460e6dda4a2 100644
--- a/docs/spring-boot/modules/ROOT/pages/jackson.adoc
+++ b/docs/spring-boot/modules/ROOT/pages/jackson.adoc
@@ -254,3 +254,33 @@ mvn dependency:list | grep -E
'jackson-(databind|annotations)'
If you override them, override both lines together and use matching release
trains (for example Jackson 2.22.x with
Jackson 3.2.x), because both lines share
`com.fasterxml.jackson.core:jackson-annotations`.
+
+== JSONPath and Spring Boot 4.1
+
+The JSONPath language (`camel-jsonpath-starter`) uses Jackson 3 through the
`Jackson3JsonProvider` and
+`Jackson3MappingProvider` of json-path 3. Spring Boot 4.1 manages json-path
2.10.0, which does not have them, and the
+Spring Boot version wins over the one Camel brings. An application with a
route that uses JSONPath then fails to start
+with `NoClassDefFoundError:
com/jayway/jsonpath/spi/json/Jackson3JsonProvider`. Spring Boot 4.2 manages
json-path
+3.0.0.
+
+With Spring Boot 4.1, use json-path 3.0.0. When the project inherits from
`spring-boot-starter-parent`, set the
+property:
+
+[source,xml]
+----
+<properties>
+ <json-path.version>3.0.0</json-path.version>
+</properties>
+----
+
+When the project imports the `spring-boot-dependencies` BOM, add json-path to
the `dependencyManagement` section of the
+project, which wins over the imported BOMs:
+
+[source,xml]
+----
+<dependency>
+ <groupId>com.jayway.jsonpath</groupId>
+ <artifactId>json-path</artifactId>
+ <version>3.0.0</version>
+</dependency>
+----
diff --git a/tooling/camel-spring-boot-dependencies-generator/pom.xml
b/tooling/camel-spring-boot-dependencies-generator/pom.xml
index cff6263b3b4..005c98641e8 100644
--- a/tooling/camel-spring-boot-dependencies-generator/pom.xml
+++ b/tooling/camel-spring-boot-dependencies-generator/pom.xml
@@ -57,6 +57,15 @@
<version>${avro-version}</version>
</dependency>
+ <!-- json-path (version from Camel): camel-jsonpath uses the
Jackson 3 providers of json-path 3,
+ while Spring Boot 4.1 manages json-path 2.x, which it only
uses in spring-boot-starter-test.
+ Remove when upgrading to Spring Boot 4.2, which manages
json-path 3.0.0. -->
+ <dependency>
+ <groupId>com.jayway.jsonpath</groupId>
+ <artifactId>json-path</artifactId>
+ <version>${json-path-version}</version>
+ </dependency>
+
<!-- Dependencies from Camel parent at the end -->
<dependency>
<groupId>org.apache.camel</groupId>
diff --git a/tooling/camel-spring-boot-dependencies/pom.xml
b/tooling/camel-spring-boot-dependencies/pom.xml
index fa8acb366d3..06c93376ca4 100644
--- a/tooling/camel-spring-boot-dependencies/pom.xml
+++ b/tooling/camel-spring-boot-dependencies/pom.xml
@@ -96,6 +96,11 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>com.jayway.jsonpath</groupId>
+ <artifactId>json-path</artifactId>
+ <version>3.0.0</version>
+ </dependency>
<dependency>
<groupId>com.openai</groupId>
<artifactId>openai-java</artifactId>