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 ea2892bce24dc15f5a1334e66776793229a6ca9f Author: James Netherton <[email protected]> AuthorDate: Mon Nov 16 13:55:48 2026 +0000 Remove the redundant hashicorp-vault Jackson2ObjectMapperBuilder substitution camel-hashicorp-vault and spring-vault-core 4.x run on Jackson 3, and quarkus-jackson always puts Jackson 3 on the classpath. Both Spring's DefaultHttpMessageConverters and spring-vault's JacksonCompat prefer Jackson 3, so Jackson2ObjectMapperBuilder is unreachable in native mode, even when another extension brings Jackson 2 in. Verified with the native analysis call tree. Co-Authored-By: Claude Opus 5.5 <[email protected]> --- extensions/hashicorp-vault/runtime/pom.xml | 5 -- .../XmlObjectMapperInitializerSubstitutions.java | 65 ---------------------- 2 files changed, 70 deletions(-) diff --git a/extensions/hashicorp-vault/runtime/pom.xml b/extensions/hashicorp-vault/runtime/pom.xml index 869bd067fc9..cbf2aafd842 100644 --- a/extensions/hashicorp-vault/runtime/pom.xml +++ b/extensions/hashicorp-vault/runtime/pom.xml @@ -52,11 +52,6 @@ <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 deleted file mode 100644 index 1cdce0d7bb4..00000000000 --- a/extensions/hashicorp-vault/runtime/src/main/java/org/apache/camel/quarkus/component/hashicorp/vault/graal/XmlObjectMapperInitializerSubstitutions.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.quarkus.component.hashicorp.vault.graal; - -import java.util.function.BooleanSupplier; - -import com.fasterxml.jackson.core.JsonFactory; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.oracle.svm.core.annotate.Alias; -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 2 is on the - * runtime - * classpath but jackson-dataformat-xml is not. - */ -@TargetClass(className = "org.springframework.http.converter.json.Jackson2ObjectMapperBuilder", onlyWith = Jackson2PresentAndDataformatXmlAbsent.class) -final class XmlObjectMapperInitializerSubstitutions { - @Alias - private JsonFactory factory; - - @SuppressWarnings("unchecked") - @Substitute - public <T extends ObjectMapper> T build() { - ObjectMapper mapper = (this.factory != null ? new ObjectMapper(this.factory) : new ObjectMapper()); - configure(mapper); - return (T) mapper; - } - - @Alias - public void configure(ObjectMapper objectMapper) { - } -} - -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(className); - return true; - } catch (ClassNotFoundException e) { - return false; - } - } -}
