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

davsclaus 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 d22ca0495f9 CAMEL-20502: JacksonAvro should be default avro 
dataformat. Add schemaResolver with classname as option in the model.
d22ca0495f9 is described below

commit d22ca0495f92f627a713fbe1022def98c8fdbf69
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Fri Mar 1 11:50:16 2024 +0100

    CAMEL-20502: JacksonAvro should be default avro dataformat. Add 
schemaResolver with classname as option in the model.
---
 .../catalog/dataformats/avroJackson.json           |  2 +-
 .../springboot/catalog/dataformats/jackson.json    |  2 +-
 .../test/AvroMarshalAndUnmarshallTest.java         |  9 +--
 .../test/AvroMarshalAndUnmarshallXmlTest.java      |  3 +-
 .../src/test/resources/routes/springDataFormat.xml |  4 +-
 .../camel-core-starter/src/main/docs/core.json     |  4 +-
 .../RestConfigurationDefinitionProperties.java     |  9 ++-
 .../src/main/docs/jackson-avro.json                |  2 +-
 .../JacksonAvroDataFormatConfiguration.java        |  1 +
 .../springboot/JacksonAvroDataFormatConverter.java | 70 ++++++++++++++++++++++
 .../src/main/docs/jackson.json                     |  2 +-
 .../springboot/JacksonDataFormatConfiguration.java |  1 +
 .../springboot/JacksonDataFormatConverter.java     | 69 +++++++++++++++++++++
 .../maven/SpringBootAutoConfigurationMojo.java     |  6 +-
 14 files changed, 167 insertions(+), 17 deletions(-)

diff --git 
a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/dataformats/avroJackson.json
 
b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/dataformats/avroJackson.json
index 8b13e2ad60f..298ce1be814 100644
--- 
a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/dataformats/avroJackson.json
+++ 
b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/dataformats/avroJackson.json
@@ -33,7 +33,7 @@
     "timezone": { "index": 14, "kind": "attribute", "displayName": "Timezone", 
"label": "advanced", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"description": "If set then Jackson will use the Timezone when 
marshalling\/unmarshalling." },
     "autoDiscoverObjectMapper": { "index": 15, "kind": "attribute", 
"displayName": "Auto Discover Object Mapper", "label": "advanced", "required": 
false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": false, "description": "If 
set to true then Jackson will lookup for an objectMapper into the registry" },
     "contentTypeHeader": { "index": 16, "kind": "attribute", "displayName": 
"Content Type Header", "required": false, "type": "boolean", "javaType": 
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": true, "description": "Whether the data format should set the 
Content-Type header with the type from the data format. For example 
application\/xml for data formats marshalling to XML, or application\/json for 
data formats marshalling to JSON" },
-    "schemaResolver": { "index": 17, "kind": "attribute", "displayName": 
"Schema Resolver", "label": "advanced", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "Optional schema resolver used to lookup 
schemas for the data in transit." },
+    "schemaResolver": { "index": 17, "kind": "attribute", "displayName": 
"Schema Resolver", "label": "advanced", "required": false, "type": "object", 
"javaType": "org.apache.camel.component.jackson.SchemaResolver", "deprecated": 
false, "autowired": false, "secret": false, "description": "Optional schema 
resolver used to lookup schemas for the data in transit." },
     "autoDiscoverSchemaResolver": { "index": 18, "kind": "attribute", 
"displayName": "Auto Discover Schema Resolver", "label": "advanced", 
"required": false, "type": "boolean", "javaType": "java.lang.Boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true, 
"description": "When not disabled, the SchemaResolver will be looked up into 
the registry" }
   }
 }
diff --git 
a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/dataformats/jackson.json
 
b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/dataformats/jackson.json
index 28ca4eea608..bb180ec4bab 100644
--- 
a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/dataformats/jackson.json
+++ 
b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/dataformats/jackson.json
@@ -33,7 +33,7 @@
     "disableFeatures": { "index": 14, "kind": "attribute", "displayName": 
"Disable Features", "label": "advanced", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "Set of features to disable on the Jackson 
com.fasterxml.jackson.databind.ObjectMapper. The features should be a name that 
matches a enum from com.fasterxml.jackson.databind.SerializationFeature, 
com.fasterxml.jackson.databind.Deserial [...]
     "allowUnmarshallType": { "index": 15, "kind": "attribute", "displayName": 
"Allow Unmarshall Type", "required": false, "type": "boolean", "javaType": 
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "description": "If enabled then Jackson is allowed to 
attempt to use the CamelJacksonUnmarshalType header during the unmarshalling. 
This should only be enabled when desired to be used." },
     "timezone": { "index": 16, "kind": "attribute", "displayName": "Timezone", 
"label": "advanced", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"description": "If set then Jackson will use the Timezone when 
marshalling\/unmarshalling. This option will have no effect on the others Json 
DataFormat, like gson and fastjson." },
-    "schemaResolver": { "index": 17, "kind": "attribute", "displayName": 
"Schema Resolver", "label": "advanced", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "Optional schema resolver used to lookup 
schemas for the data in transit." },
+    "schemaResolver": { "index": 17, "kind": "attribute", "displayName": 
"Schema Resolver", "label": "advanced", "required": false, "type": "object", 
"javaType": "org.apache.camel.component.jackson.SchemaResolver", "deprecated": 
false, "autowired": false, "secret": false, "description": "Optional schema 
resolver used to lookup schemas for the data in transit." },
     "autoDiscoverSchemaResolver": { "index": 18, "kind": "attribute", 
"displayName": "Auto Discover Schema Resolver", "label": "advanced", 
"required": false, "type": "boolean", "javaType": "java.lang.Boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true, 
"description": "When not disabled, the SchemaResolver will be looked up into 
the registry" },
     "namingStrategy": { "index": 19, "kind": "attribute", "displayName": 
"Naming Strategy", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"description": "If set then Jackson will use the the defined Property Naming 
Strategy.Possible values are: LOWER_CAMEL_CASE, LOWER_DOT_CASE, LOWER_CASE, 
KEBAB_CASE, SNAKE_CASE and UPPER_CAMEL_CASE" },
     "contentTypeHeader": { "index": 20, "kind": "attribute", "displayName": 
"Content Type Header", "required": false, "type": "boolean", "javaType": 
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": true, "description": "Whether the data format should set the 
Content-Type header with the type from the data format. For example 
application\/xml for data formats marshalling to XML, or application\/json for 
data formats marshalling to JSON" }
diff --git 
a/components-starter/camel-avro-starter/src/test/java/org/apache/camel/dataformat/avro/springboot/test/AvroMarshalAndUnmarshallTest.java
 
b/components-starter/camel-avro-starter/src/test/java/org/apache/camel/dataformat/avro/springboot/test/AvroMarshalAndUnmarshallTest.java
index c9530076def..ebc234072b7 100644
--- 
a/components-starter/camel-avro-starter/src/test/java/org/apache/camel/dataformat/avro/springboot/test/AvroMarshalAndUnmarshallTest.java
+++ 
b/components-starter/camel-avro-starter/src/test/java/org/apache/camel/dataformat/avro/springboot/test/AvroMarshalAndUnmarshallTest.java
@@ -24,6 +24,7 @@ import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.dataformat.avro.AvroDataFormat;
+import org.apache.camel.model.dataformat.AvroLibrary;
 import org.apache.camel.spring.boot.CamelAutoConfiguration;
 import org.junit.jupiter.api.Test;
 
@@ -83,7 +84,7 @@ public class AvroMarshalAndUnmarshallTest {
             context.addRoutes(new RouteBuilder() {
                 @Override
                 public void configure() throws Exception {
-                    from("direct:unmarshalC").unmarshal().avro(new 
CamelException("wrong schema"))
+                    
from("direct:unmarshalC").unmarshal().avro(AvroLibrary.ApacheAvro, new 
CamelException("wrong schema"))
                             .to("mock:reverse");
                 }
             });
@@ -127,10 +128,10 @@ public class AvroMarshalAndUnmarshallTest {
                     from("direct:in").marshal(format);
                     from("direct:back").unmarshal(format).to("mock:reverse");
 
-                    from("direct:marshal").marshal().avro();
-                    
from("direct:unmarshalA").unmarshal().avro(Value.class.getName()).to("mock:reverse");
+                    
from("direct:marshal").marshal().avro(AvroLibrary.ApacheAvro);
+                    
from("direct:unmarshalA").unmarshal().avro(AvroLibrary.ApacheAvro, 
Value.class.getName()).to("mock:reverse");
 
-                    
from("direct:unmarshalB").unmarshal().avro(Value.SCHEMA$).to("mock:reverse");
+                    
from("direct:unmarshalB").unmarshal().avro(AvroLibrary.ApacheAvro, 
Value.SCHEMA$).to("mock:reverse");
                 }
             };
         }
diff --git 
a/components-starter/camel-avro-starter/src/test/java/org/apache/camel/dataformat/avro/springboot/test/AvroMarshalAndUnmarshallXmlTest.java
 
b/components-starter/camel-avro-starter/src/test/java/org/apache/camel/dataformat/avro/springboot/test/AvroMarshalAndUnmarshallXmlTest.java
index 2b21b5801e6..e15f777a0ec 100644
--- 
a/components-starter/camel-avro-starter/src/test/java/org/apache/camel/dataformat/avro/springboot/test/AvroMarshalAndUnmarshallXmlTest.java
+++ 
b/components-starter/camel-avro-starter/src/test/java/org/apache/camel/dataformat/avro/springboot/test/AvroMarshalAndUnmarshallXmlTest.java
@@ -24,6 +24,7 @@ import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.dataformat.avro.AvroDataFormat;
+import org.apache.camel.model.dataformat.AvroLibrary;
 import org.apache.camel.spring.boot.CamelAutoConfiguration;
 import org.junit.jupiter.api.Test;
 
@@ -80,7 +81,7 @@ public class AvroMarshalAndUnmarshallXmlTest {
             context.addRoutes(new RouteBuilder() {
                 @Override
                 public void configure() throws Exception {
-                    from("direct:unmarshalC").unmarshal().avro(new 
CamelException("wrong schema"))
+                    
from("direct:unmarshalC").unmarshal().avro(AvroLibrary.ApacheAvro, new 
CamelException("wrong schema"))
                             .to("mock:reverse");
                 }
             });
diff --git 
a/components-starter/camel-avro-starter/src/test/resources/routes/springDataFormat.xml
 
b/components-starter/camel-avro-starter/src/test/resources/routes/springDataFormat.xml
index 0778dc3817e..70c7e013995 100644
--- 
a/components-starter/camel-avro-starter/src/test/resources/routes/springDataFormat.xml
+++ 
b/components-starter/camel-avro-starter/src/test/resources/routes/springDataFormat.xml
@@ -21,13 +21,13 @@
         <route>
             <from uri="direct:in"/>
             <marshal>
-                <avro 
instanceClassName="org.apache.camel.dataformat.avro.springboot.test.Value"/>
+                <avro 
instanceClassName="org.apache.camel.dataformat.avro.springboot.test.Value" 
library="ApacheAvro"/>
             </marshal>
         </route>
         <route>
             <from uri="direct:back"/>
             <unmarshal>
-                <avro 
instanceClassName="org.apache.camel.dataformat.avro.springboot.test.Value"/>
+                <avro 
instanceClassName="org.apache.camel.dataformat.avro.springboot.test.Value" 
library="ApacheAvro"/>
             </unmarshal>
             <to uri="mock:reverse"/>
         </route>
diff --git a/components-starter/camel-core-starter/src/main/docs/core.json 
b/components-starter/camel-core-starter/src/main/docs/core.json
index 564e289b72a..6d735ebee11 100644
--- a/components-starter/camel-core-starter/src/main/docs/core.json
+++ b/components-starter/camel-core-starter/src/main/docs/core.json
@@ -854,9 +854,9 @@
     {
       "name": "camel.rest.use-x-forward-headers",
       "type": "java.lang.Boolean",
-      "description": "Whether to use X-Forward headers for Host and related 
setting. The default value is true.",
+      "description": "Whether to use X-Forward headers to set host etc. for 
OpenApi. This may be needed in special cases involving reverse-proxy and 
networking going from HTTP to HTTPS etc. Then the proxy can send X-Forward 
headers (X-Forwarded-Proto) that influences the host names in the OpenAPI 
schema that camel-openapi-java generates from Rest DSL routes.",
       "sourceType": 
"org.apache.camel.model.rest.springboot.RestConfigurationDefinitionProperties",
-      "defaultValue": true
+      "defaultValue": false
     },
     {
       "name": "camel.rest.xml-data-format",
diff --git 
a/components-starter/camel-core-starter/src/main/java/org/apache/camel/model/rest/springboot/RestConfigurationDefinitionProperties.java
 
b/components-starter/camel-core-starter/src/main/java/org/apache/camel/model/rest/springboot/RestConfigurationDefinitionProperties.java
index 7da0c2fa0e2..a32bda86e4f 100644
--- 
a/components-starter/camel-core-starter/src/main/java/org/apache/camel/model/rest/springboot/RestConfigurationDefinitionProperties.java
+++ 
b/components-starter/camel-core-starter/src/main/java/org/apache/camel/model/rest/springboot/RestConfigurationDefinitionProperties.java
@@ -79,10 +79,13 @@ public class RestConfigurationDefinitionProperties {
      */
     private String apiHost;
     /**
-     * Whether to use X-Forward headers for Host and related setting. The
-     * default value is true.
+     * Whether to use X-Forward headers to set host etc. for OpenApi. This may
+     * be needed in special cases involving reverse-proxy and networking going
+     * from HTTP to HTTPS etc. Then the proxy can send X-Forward headers
+     * (X-Forwarded-Proto) that influences the host names in the OpenAPI schema
+     * that camel-openapi-java generates from Rest DSL routes.
      */
-    private Boolean useXForwardHeaders = true;
+    private Boolean useXForwardHeaders = false;
     /**
      * Sets the location of the api document the REST producer will use to
      * validate the REST uri and query parameters are valid accordingly to the
diff --git 
a/components-starter/camel-jackson-avro-starter/src/main/docs/jackson-avro.json 
b/components-starter/camel-jackson-avro-starter/src/main/docs/jackson-avro.json
index e16817e27be..2dfd3f4daf9 100644
--- 
a/components-starter/camel-jackson-avro-starter/src/main/docs/jackson-avro.json
+++ 
b/components-starter/camel-jackson-avro-starter/src/main/docs/jackson-avro.json
@@ -110,7 +110,7 @@
     {
       "name": "camel.dataformat.avro-jackson.schema-resolver",
       "type": "java.lang.String",
-      "description": "Optional schema resolver used to lookup schemas for the 
data in transit.",
+      "description": "Optional schema resolver used to lookup schemas for the 
data in transit. The option is a 
org.apache.camel.component.jackson.SchemaResolver type.",
       "sourceType": 
"org.apache.camel.component.jackson.avro.springboot.JacksonAvroDataFormatConfiguration"
     },
     {
diff --git 
a/components-starter/camel-jackson-avro-starter/src/main/java/org/apache/camel/component/jackson/avro/springboot/JacksonAvroDataFormatConfiguration.java
 
b/components-starter/camel-jackson-avro-starter/src/main/java/org/apache/camel/component/jackson/avro/springboot/JacksonAvroDataFormatConfiguration.java
index 44d1ffd80fe..bb7d6457dcd 100644
--- 
a/components-starter/camel-jackson-avro-starter/src/main/java/org/apache/camel/component/jackson/avro/springboot/JacksonAvroDataFormatConfiguration.java
+++ 
b/components-starter/camel-jackson-avro-starter/src/main/java/org/apache/camel/component/jackson/avro/springboot/JacksonAvroDataFormatConfiguration.java
@@ -129,6 +129,7 @@ public class JacksonAvroDataFormatConfiguration
     private Boolean contentTypeHeader = true;
     /**
      * Optional schema resolver used to lookup schemas for the data in transit.
+     * The option is a org.apache.camel.component.jackson.SchemaResolver type.
      */
     private String schemaResolver;
     /**
diff --git 
a/components-starter/camel-jackson-avro-starter/src/main/java/org/apache/camel/component/jackson/avro/springboot/JacksonAvroDataFormatConverter.java
 
b/components-starter/camel-jackson-avro-starter/src/main/java/org/apache/camel/component/jackson/avro/springboot/JacksonAvroDataFormatConverter.java
new file mode 100644
index 00000000000..8c84f6a2682
--- /dev/null
+++ 
b/components-starter/camel-jackson-avro-starter/src/main/java/org/apache/camel/component/jackson/avro/springboot/JacksonAvroDataFormatConverter.java
@@ -0,0 +1,70 @@
+/*
+ * 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.component.jackson.avro.springboot;
+
+import java.util.LinkedHashSet;
+import java.util.Set;
+import org.apache.camel.CamelContext;
+import org.springframework.beans.factory.annotation.Autowired;
+import 
org.springframework.boot.context.properties.ConfigurationPropertiesBinding;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.convert.TypeDescriptor;
+import org.springframework.core.convert.converter.GenericConverter;
+import org.springframework.stereotype.Component;
+
+/**
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@Configuration(proxyBeanMethods = false)
+@ConfigurationPropertiesBinding
+@Component
+public class JacksonAvroDataFormatConverter implements GenericConverter {
+
+    @Autowired
+    private ApplicationContext applicationContext;
+    private final CamelContext camelContext;
+
+    public JacksonAvroDataFormatConverter(
+            org.apache.camel.CamelContext camelContext) {
+        this.camelContext = camelContext;
+    }
+
+    public Set<ConvertiblePair> getConvertibleTypes() {
+        Set<ConvertiblePair> answer = new LinkedHashSet<>();
+        answer.add(new ConvertiblePair(String.class, 
org.apache.camel.component.jackson.SchemaResolver.class));
+        return answer;
+    }
+
+    public Object convert(
+            Object source,
+            TypeDescriptor sourceType,
+            TypeDescriptor targetType) {
+        if (source == null) {
+            return null;
+        }
+        String ref = source.toString();
+        if (!ref.startsWith("#")) {
+            return null;
+        }
+        ref = ref.startsWith("#bean:") ? ref.substring(6) : ref.substring(1);
+        switch (targetType.getName()) {
+            case "org.apache.camel.component.jackson.SchemaResolver": return 
applicationContext.getBean(ref, 
org.apache.camel.component.jackson.SchemaResolver.class);
+        }
+        return null;
+    }
+}
\ No newline at end of file
diff --git 
a/components-starter/camel-jackson-starter/src/main/docs/jackson.json 
b/components-starter/camel-jackson-starter/src/main/docs/jackson.json
index f9243179118..60b9421489a 100644
--- a/components-starter/camel-jackson-starter/src/main/docs/jackson.json
+++ b/components-starter/camel-jackson-starter/src/main/docs/jackson.json
@@ -123,7 +123,7 @@
     {
       "name": "camel.dataformat.jackson.schema-resolver",
       "type": "java.lang.String",
-      "description": "Optional schema resolver used to lookup schemas for the 
data in transit.",
+      "description": "Optional schema resolver used to lookup schemas for the 
data in transit. The option is a 
org.apache.camel.component.jackson.SchemaResolver type.",
       "sourceType": 
"org.apache.camel.component.jackson.springboot.JacksonDataFormatConfiguration"
     },
     {
diff --git 
a/components-starter/camel-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatConfiguration.java
 
b/components-starter/camel-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatConfiguration.java
index 89627f06551..d3cc4a8d27f 100644
--- 
a/components-starter/camel-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatConfiguration.java
+++ 
b/components-starter/camel-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatConfiguration.java
@@ -128,6 +128,7 @@ public class JacksonDataFormatConfiguration
     private String timezone;
     /**
      * Optional schema resolver used to lookup schemas for the data in transit.
+     * The option is a org.apache.camel.component.jackson.SchemaResolver type.
      */
     private String schemaResolver;
     /**
diff --git 
a/components-starter/camel-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatConverter.java
 
b/components-starter/camel-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatConverter.java
new file mode 100644
index 00000000000..d915033b881
--- /dev/null
+++ 
b/components-starter/camel-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatConverter.java
@@ -0,0 +1,69 @@
+/*
+ * 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.component.jackson.springboot;
+
+import java.util.LinkedHashSet;
+import java.util.Set;
+import org.apache.camel.CamelContext;
+import org.springframework.beans.factory.annotation.Autowired;
+import 
org.springframework.boot.context.properties.ConfigurationPropertiesBinding;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.convert.TypeDescriptor;
+import org.springframework.core.convert.converter.GenericConverter;
+import org.springframework.stereotype.Component;
+
+/**
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@Configuration(proxyBeanMethods = false)
+@ConfigurationPropertiesBinding
+@Component
+public class JacksonDataFormatConverter implements GenericConverter {
+
+    @Autowired
+    private ApplicationContext applicationContext;
+    private final CamelContext camelContext;
+
+    public JacksonDataFormatConverter(org.apache.camel.CamelContext 
camelContext) {
+        this.camelContext = camelContext;
+    }
+
+    public Set<ConvertiblePair> getConvertibleTypes() {
+        Set<ConvertiblePair> answer = new LinkedHashSet<>();
+        answer.add(new ConvertiblePair(String.class, 
org.apache.camel.component.jackson.SchemaResolver.class));
+        return answer;
+    }
+
+    public Object convert(
+            Object source,
+            TypeDescriptor sourceType,
+            TypeDescriptor targetType) {
+        if (source == null) {
+            return null;
+        }
+        String ref = source.toString();
+        if (!ref.startsWith("#")) {
+            return null;
+        }
+        ref = ref.startsWith("#bean:") ? ref.substring(6) : ref.substring(1);
+        switch (targetType.getName()) {
+            case "org.apache.camel.component.jackson.SchemaResolver": return 
applicationContext.getBean(ref, 
org.apache.camel.component.jackson.SchemaResolver.class);
+        }
+        return null;
+    }
+}
\ No newline at end of file
diff --git 
a/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootAutoConfigurationMojo.java
 
b/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootAutoConfigurationMojo.java
index 70dc455f05d..0fdb94d5516 100644
--- 
a/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootAutoConfigurationMojo.java
+++ 
b/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootAutoConfigurationMojo.java
@@ -1512,13 +1512,17 @@ public class SpringBootAutoConfigurationMojo extends 
AbstractSpringBootGenerator
         javaClass.setPackage(packageName);
         javaClass.setName(name);
         javaClass.getJavaDoc().setFullText("Generated by 
camel-package-maven-plugin - do not edit this file!");
+        
javaClass.addAnnotation(Configuration.class).setLiteralValue("proxyBeanMethods",
 "false");
+        
javaClass.addAnnotation("org.springframework.boot.context.properties.ConfigurationPropertiesBinding");
+        javaClass.addAnnotation("org.springframework.stereotype.Component");
         javaClass.addImport("java.util.LinkedHashSet");
         javaClass.addImport("java.util.Set");
         javaClass.addImport("org.apache.camel.CamelContext");
         javaClass.addImport("org.springframework.core.convert.TypeDescriptor");
         
javaClass.addImport("org.springframework.core.convert.converter.GenericConverter");
 
-        
javaClass.implementInterface("org.springframework.core.convert.converter.GenericConverter");
+        javaClass.implementInterface("GenericConverter");
+        
javaClass.addField().setPrivate().setName("applicationContext").setType(loadClass("org.springframework.context.ApplicationContext")).addAnnotation(Autowired.class);
         
javaClass.addField().setPrivate().setFinal(true).setName("camelContext").setType(loadClass("org.apache.camel.CamelContext"));
         
javaClass.addMethod().setConstructor(true).setPublic().setPublic().setName(name).addParameter("org.apache.camel.CamelContext",
 "camelContext")
                 .setBody("this.camelContext = camelContext;\n");

Reply via email to