This is an automated email from the ASF dual-hosted git repository.

JiriOndrusek pushed a commit to branch camel-main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit e99d1413f3489d09c8479f4a86346e22e6325480
Author: jiriOndrusek-agent <[email protected]>
AuthorDate: Tue Nov 10 13:42:32 2026 +0000

    Apply the hashicorp-vault Jackson2ObjectMapperBuilder substitution only 
with Jackson 2 after CAMEL-22857
    
    camel-hashicorp-vault moved to Jackson 3, so Jackson 2 is no longer on the
    classpath and the substitution did not compile.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 extensions/hashicorp-vault/runtime/pom.xml           |  5 +++++
 .../XmlObjectMapperInitializerSubstitutions.java     | 20 +++++++++++++-------
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/extensions/hashicorp-vault/runtime/pom.xml 
b/extensions/hashicorp-vault/runtime/pom.xml
index cbf2aafd842..869bd067fc9 100644
--- a/extensions/hashicorp-vault/runtime/pom.xml
+++ b/extensions/hashicorp-vault/runtime/pom.xml
@@ -52,6 +52,11 @@
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-hashicorp-vault</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+            <scope>provided</scope>
+        </dependency>
         <dependency>
             <groupId>org.graalvm.sdk</groupId>
             <artifactId>nativeimage</artifactId>
diff --git 
a/extensions/hashicorp-vault/runtime/src/main/java/org/apache/camel/quarkus/component/hashicorp/vault/graal/XmlObjectMapperInitializerSubstitutions.java
 
b/extensions/hashicorp-vault/runtime/src/main/java/org/apache/camel/quarkus/component/hashicorp/vault/graal/XmlObjectMapperInitializerSubstitutions.java
index e914ec8566f..1cdce0d7bb4 100644
--- 
a/extensions/hashicorp-vault/runtime/src/main/java/org/apache/camel/quarkus/component/hashicorp/vault/graal/XmlObjectMapperInitializerSubstitutions.java
+++ 
b/extensions/hashicorp-vault/runtime/src/main/java/org/apache/camel/quarkus/component/hashicorp/vault/graal/XmlObjectMapperInitializerSubstitutions.java
@@ -25,10 +25,11 @@ import com.oracle.svm.core.annotate.Substitute;
 import com.oracle.svm.core.annotate.TargetClass;
 
 /**
- * Substitute Jackson2ObjectMapperBuilder.build() method to avoid references 
to XmlMapper, when jackson-dataformat-xml
- * is not on the runtime classpath.
+ * Substitute Jackson2ObjectMapperBuilder.build() method to avoid references 
to XmlMapper, when Jackson 2 is on the
+ * runtime
+ * classpath but jackson-dataformat-xml is not.
  */
-@TargetClass(className = 
"org.springframework.http.converter.json.Jackson2ObjectMapperBuilder", onlyWith 
= JacksonDataformatXmlIsAbsent.class)
+@TargetClass(className = 
"org.springframework.http.converter.json.Jackson2ObjectMapperBuilder", onlyWith 
= Jackson2PresentAndDataformatXmlAbsent.class)
 final class XmlObjectMapperInitializerSubstitutions {
     @Alias
     private JsonFactory factory;
@@ -46,14 +47,19 @@ final class XmlObjectMapperInitializerSubstitutions {
     }
 }
 
-final class JacksonDataformatXmlIsAbsent implements BooleanSupplier {
+final class Jackson2PresentAndDataformatXmlAbsent implements BooleanSupplier {
     @Override
     public boolean getAsBoolean() {
+        return isPresent("com.fasterxml.jackson.databind.ObjectMapper")
+                && 
!isPresent("com.fasterxml.jackson.dataformat.xml.XmlMapper");
+    }
+
+    private static boolean isPresent(String className) {
         try {
-            
Thread.currentThread().getContextClassLoader().loadClass("com.fasterxml.jackson.dataformat.xml.XmlMapper");
-            return false;
-        } catch (ClassNotFoundException e) {
+            
Thread.currentThread().getContextClassLoader().loadClass(className);
             return true;
+        } catch (ClassNotFoundException e) {
+            return false;
         }
     }
 }

Reply via email to