You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2017/02/01 10:40:42 UTC

[1/3] camel git commit: CAMEL-10542: DataFormat from registry is used for every dataformat operation (marshal/unmarshal)

Repository: camel
Updated Branches:
  refs/heads/master d4c4a84f5 -> c0a9f5cd4


http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-protobuf-starter/src/main/java/org/apache/camel/dataformat/protobuf/springboot/ProtobufDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-protobuf-starter/src/main/java/org/apache/camel/dataformat/protobuf/springboot/ProtobufDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-protobuf-starter/src/main/java/org/apache/camel/dataformat/protobuf/springboot/ProtobufDataFormatAutoConfiguration.java
index 72f025e..417d610 100644
--- a/platforms/spring-boot/components-starter/camel-protobuf-starter/src/main/java/org/apache/camel/dataformat/protobuf/springboot/ProtobufDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-protobuf-starter/src/main/java/org/apache/camel/dataformat/protobuf/springboot/ProtobufDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.protobuf.ProtobufDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,27 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(ProtobufDataFormatConfiguration.class)
 public class ProtobufDataFormatAutoConfiguration {
 
-    @Bean(name = "protobuf-dataformat")
-    @Scope("prototype")
+    @Bean(name = "protobuf-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(ProtobufDataFormat.class)
-    public ProtobufDataFormat configureProtobufDataFormat(
-            CamelContext camelContext,
-            ProtobufDataFormatConfiguration configuration) throws Exception {
-        ProtobufDataFormat dataformat = new ProtobufDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(ProtobufDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureProtobufDataFormatFactory(
+            final CamelContext camelContext,
+            final ProtobufDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                ProtobufDataFormat dataformat = new ProtobufDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(ProtobufDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-rss-starter/src/main/java/org/apache/camel/dataformat/rss/springboot/RssDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-rss-starter/src/main/java/org/apache/camel/dataformat/rss/springboot/RssDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-rss-starter/src/main/java/org/apache/camel/dataformat/rss/springboot/RssDataFormatAutoConfiguration.java
index 68b7ed8..708a3bd 100644
--- a/platforms/spring-boot/components-starter/camel-rss-starter/src/main/java/org/apache/camel/dataformat/rss/springboot/RssDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-rss-starter/src/main/java/org/apache/camel/dataformat/rss/springboot/RssDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.rss.RssDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,26 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(RssDataFormatConfiguration.class)
 public class RssDataFormatAutoConfiguration {
 
-    @Bean(name = "rss-dataformat")
-    @Scope("prototype")
+    @Bean(name = "rss-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(RssDataFormat.class)
-    public RssDataFormat configureRssDataFormat(CamelContext camelContext,
-            RssDataFormatConfiguration configuration) throws Exception {
-        RssDataFormat dataformat = new RssDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(RssDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureRssDataFormatFactory(
+            final CamelContext camelContext,
+            final RssDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                RssDataFormat dataformat = new RssDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(RssDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-snakeyaml-starter/src/main/java/org/apache/camel/component/snakeyaml/springboot/SnakeYAMLDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-snakeyaml-starter/src/main/java/org/apache/camel/component/snakeyaml/springboot/SnakeYAMLDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-snakeyaml-starter/src/main/java/org/apache/camel/component/snakeyaml/springboot/SnakeYAMLDataFormatAutoConfiguration.java
index d5f11b7..c5595d9 100644
--- a/platforms/spring-boot/components-starter/camel-snakeyaml-starter/src/main/java/org/apache/camel/component/snakeyaml/springboot/SnakeYAMLDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-snakeyaml-starter/src/main/java/org/apache/camel/component/snakeyaml/springboot/SnakeYAMLDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.component.snakeyaml.SnakeYAMLDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,27 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(SnakeYAMLDataFormatConfiguration.class)
 public class SnakeYAMLDataFormatAutoConfiguration {
 
-    @Bean(name = "yaml-snakeyaml-dataformat")
-    @Scope("prototype")
+    @Bean(name = "yaml-snakeyaml-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(SnakeYAMLDataFormat.class)
-    public SnakeYAMLDataFormat configureSnakeYAMLDataFormat(
-            CamelContext camelContext,
-            SnakeYAMLDataFormatConfiguration configuration) throws Exception {
-        SnakeYAMLDataFormat dataformat = new SnakeYAMLDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(SnakeYAMLDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureSnakeYAMLDataFormatFactory(
+            final CamelContext camelContext,
+            final SnakeYAMLDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                SnakeYAMLDataFormat dataformat = new SnakeYAMLDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(SnakeYAMLDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-soap-starter/src/main/java/org/apache/camel/dataformat/soap/springboot/SoapJaxbDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-soap-starter/src/main/java/org/apache/camel/dataformat/soap/springboot/SoapJaxbDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-soap-starter/src/main/java/org/apache/camel/dataformat/soap/springboot/SoapJaxbDataFormatAutoConfiguration.java
index 66da5e5..85e6b5d 100644
--- a/platforms/spring-boot/components-starter/camel-soap-starter/src/main/java/org/apache/camel/dataformat/soap/springboot/SoapJaxbDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-soap-starter/src/main/java/org/apache/camel/dataformat/soap/springboot/SoapJaxbDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.soap.SoapJaxbDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,27 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(SoapJaxbDataFormatConfiguration.class)
 public class SoapJaxbDataFormatAutoConfiguration {
 
-    @Bean(name = "soapjaxb-dataformat")
-    @Scope("prototype")
+    @Bean(name = "soapjaxb-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(SoapJaxbDataFormat.class)
-    public SoapJaxbDataFormat configureSoapJaxbDataFormat(
-            CamelContext camelContext,
-            SoapJaxbDataFormatConfiguration configuration) throws Exception {
-        SoapJaxbDataFormat dataformat = new SoapJaxbDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(SoapJaxbDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureSoapJaxbDataFormatFactory(
+            final CamelContext camelContext,
+            final SoapJaxbDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                SoapJaxbDataFormat dataformat = new SoapJaxbDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(SoapJaxbDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-syslog-starter/src/main/java/org/apache/camel/component/syslog/springboot/SyslogDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-syslog-starter/src/main/java/org/apache/camel/component/syslog/springboot/SyslogDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-syslog-starter/src/main/java/org/apache/camel/component/syslog/springboot/SyslogDataFormatAutoConfiguration.java
index b92c561..6c96a3f 100644
--- a/platforms/spring-boot/components-starter/camel-syslog-starter/src/main/java/org/apache/camel/component/syslog/springboot/SyslogDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-syslog-starter/src/main/java/org/apache/camel/component/syslog/springboot/SyslogDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.component.syslog.SyslogDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,27 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(SyslogDataFormatConfiguration.class)
 public class SyslogDataFormatAutoConfiguration {
 
-    @Bean(name = "syslog-dataformat")
-    @Scope("prototype")
+    @Bean(name = "syslog-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(SyslogDataFormat.class)
-    public SyslogDataFormat configureSyslogDataFormat(
-            CamelContext camelContext,
-            SyslogDataFormatConfiguration configuration) throws Exception {
-        SyslogDataFormat dataformat = new SyslogDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(SyslogDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureSyslogDataFormatFactory(
+            final CamelContext camelContext,
+            final SyslogDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                SyslogDataFormat dataformat = new SyslogDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(SyslogDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-tagsoup-starter/src/main/java/org/apache/camel/dataformat/tagsoup/springboot/TidyMarkupDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-tagsoup-starter/src/main/java/org/apache/camel/dataformat/tagsoup/springboot/TidyMarkupDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-tagsoup-starter/src/main/java/org/apache/camel/dataformat/tagsoup/springboot/TidyMarkupDataFormatAutoConfiguration.java
index 66ec2fd..b9f2ed8 100644
--- a/platforms/spring-boot/components-starter/camel-tagsoup-starter/src/main/java/org/apache/camel/dataformat/tagsoup/springboot/TidyMarkupDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-tagsoup-starter/src/main/java/org/apache/camel/dataformat/tagsoup/springboot/TidyMarkupDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.tagsoup.TidyMarkupDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,28 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(TidyMarkupDataFormatConfiguration.class)
 public class TidyMarkupDataFormatAutoConfiguration {
 
-    @Bean(name = "tidyMarkup-dataformat")
-    @Scope("prototype")
+    @Bean(name = "tidyMarkup-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(TidyMarkupDataFormat.class)
-    public TidyMarkupDataFormat configureTidyMarkupDataFormat(
-            CamelContext camelContext,
-            TidyMarkupDataFormatConfiguration configuration) throws Exception {
-        TidyMarkupDataFormat dataformat = new TidyMarkupDataFormat();
-        if (CamelContextAware.class
-                .isAssignableFrom(TidyMarkupDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureTidyMarkupDataFormatFactory(
+            final CamelContext camelContext,
+            final TidyMarkupDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                TidyMarkupDataFormat dataformat = new TidyMarkupDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(TidyMarkupDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-tarfile-starter/src/main/java/org/apache/camel/dataformat/tarfile/springboot/TarFileDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-tarfile-starter/src/main/java/org/apache/camel/dataformat/tarfile/springboot/TarFileDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-tarfile-starter/src/main/java/org/apache/camel/dataformat/tarfile/springboot/TarFileDataFormatAutoConfiguration.java
index 614b891..24b34f7 100644
--- a/platforms/spring-boot/components-starter/camel-tarfile-starter/src/main/java/org/apache/camel/dataformat/tarfile/springboot/TarFileDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-tarfile-starter/src/main/java/org/apache/camel/dataformat/tarfile/springboot/TarFileDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.tarfile.TarFileDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,27 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(TarFileDataFormatConfiguration.class)
 public class TarFileDataFormatAutoConfiguration {
 
-    @Bean(name = "tarfile-dataformat")
-    @Scope("prototype")
+    @Bean(name = "tarfile-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(TarFileDataFormat.class)
-    public TarFileDataFormat configureTarFileDataFormat(
-            CamelContext camelContext,
-            TarFileDataFormatConfiguration configuration) throws Exception {
-        TarFileDataFormat dataformat = new TarFileDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(TarFileDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureTarFileDataFormatFactory(
+            final CamelContext camelContext,
+            final TarFileDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                TarFileDataFormat dataformat = new TarFileDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(TarFileDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityCsvDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityCsvDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityCsvDataFormatAutoConfiguration.java
index 23d657a..9430915 100644
--- a/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityCsvDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityCsvDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.univocity.UniVocityCsvDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,28 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(UniVocityCsvDataFormatConfiguration.class)
 public class UniVocityCsvDataFormatAutoConfiguration {
 
-    @Bean(name = "univocity-csv-dataformat")
-    @Scope("prototype")
+    @Bean(name = "univocity-csv-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(UniVocityCsvDataFormat.class)
-    public UniVocityCsvDataFormat configureUniVocityCsvDataFormat(
-            CamelContext camelContext,
-            UniVocityCsvDataFormatConfiguration configuration) throws Exception {
-        UniVocityCsvDataFormat dataformat = new UniVocityCsvDataFormat();
-        if (CamelContextAware.class
-                .isAssignableFrom(UniVocityCsvDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureUniVocityCsvDataFormatFactory(
+            final CamelContext camelContext,
+            final UniVocityCsvDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                UniVocityCsvDataFormat dataformat = new UniVocityCsvDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(UniVocityCsvDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityFixedWidthDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityFixedWidthDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityFixedWidthDataFormatAutoConfiguration.java
index 56b8cea..b7e50b3 100644
--- a/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityFixedWidthDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityFixedWidthDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.univocity.UniVocityFixedWidthDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,29 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(UniVocityFixedWidthDataFormatConfiguration.class)
 public class UniVocityFixedWidthDataFormatAutoConfiguration {
 
-    @Bean(name = "univocity-fixed-dataformat")
-    @Scope("prototype")
+    @Bean(name = "univocity-fixed-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(UniVocityFixedWidthDataFormat.class)
-    public UniVocityFixedWidthDataFormat configureUniVocityFixedWidthDataFormat(
-            CamelContext camelContext,
-            UniVocityFixedWidthDataFormatConfiguration configuration)
-            throws Exception {
-        UniVocityFixedWidthDataFormat dataformat = new UniVocityFixedWidthDataFormat();
-        if (CamelContextAware.class
-                .isAssignableFrom(UniVocityFixedWidthDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureUniVocityFixedWidthDataFormatFactory(
+            final CamelContext camelContext,
+            final UniVocityFixedWidthDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                UniVocityFixedWidthDataFormat dataformat = new UniVocityFixedWidthDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(UniVocityFixedWidthDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityTsvDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityTsvDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityTsvDataFormatAutoConfiguration.java
index d137e5b..aaaff6c 100644
--- a/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityTsvDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityTsvDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.univocity.UniVocityTsvDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,28 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(UniVocityTsvDataFormatConfiguration.class)
 public class UniVocityTsvDataFormatAutoConfiguration {
 
-    @Bean(name = "univocity-tsv-dataformat")
-    @Scope("prototype")
+    @Bean(name = "univocity-tsv-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(UniVocityTsvDataFormat.class)
-    public UniVocityTsvDataFormat configureUniVocityTsvDataFormat(
-            CamelContext camelContext,
-            UniVocityTsvDataFormatConfiguration configuration) throws Exception {
-        UniVocityTsvDataFormat dataformat = new UniVocityTsvDataFormat();
-        if (CamelContextAware.class
-                .isAssignableFrom(UniVocityTsvDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureUniVocityTsvDataFormatFactory(
+            final CamelContext camelContext,
+            final UniVocityTsvDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                UniVocityTsvDataFormat dataformat = new UniVocityTsvDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(UniVocityTsvDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-xmlbeans-starter/src/main/java/org/apache/camel/converter/xmlbeans/springboot/XmlBeansDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-xmlbeans-starter/src/main/java/org/apache/camel/converter/xmlbeans/springboot/XmlBeansDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-xmlbeans-starter/src/main/java/org/apache/camel/converter/xmlbeans/springboot/XmlBeansDataFormatAutoConfiguration.java
index 3b1d7fe..7ec6a95 100644
--- a/platforms/spring-boot/components-starter/camel-xmlbeans-starter/src/main/java/org/apache/camel/converter/xmlbeans/springboot/XmlBeansDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-xmlbeans-starter/src/main/java/org/apache/camel/converter/xmlbeans/springboot/XmlBeansDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.converter.xmlbeans.XmlBeansDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,27 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(XmlBeansDataFormatConfiguration.class)
 public class XmlBeansDataFormatAutoConfiguration {
 
-    @Bean(name = "xmlBeans-dataformat")
-    @Scope("prototype")
+    @Bean(name = "xmlBeans-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(XmlBeansDataFormat.class)
-    public XmlBeansDataFormat configureXmlBeansDataFormat(
-            CamelContext camelContext,
-            XmlBeansDataFormatConfiguration configuration) throws Exception {
-        XmlBeansDataFormat dataformat = new XmlBeansDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(XmlBeansDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureXmlBeansDataFormatFactory(
+            final CamelContext camelContext,
+            final XmlBeansDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                XmlBeansDataFormat dataformat = new XmlBeansDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(XmlBeansDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-xmljson-starter/src/main/java/org/apache/camel/dataformat/xmljson/springboot/XmlJsonDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-xmljson-starter/src/main/java/org/apache/camel/dataformat/xmljson/springboot/XmlJsonDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-xmljson-starter/src/main/java/org/apache/camel/dataformat/xmljson/springboot/XmlJsonDataFormatAutoConfiguration.java
index 2e76919..6c6c7b7 100644
--- a/platforms/spring-boot/components-starter/camel-xmljson-starter/src/main/java/org/apache/camel/dataformat/xmljson/springboot/XmlJsonDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-xmljson-starter/src/main/java/org/apache/camel/dataformat/xmljson/springboot/XmlJsonDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.xmljson.XmlJsonDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,27 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(XmlJsonDataFormatConfiguration.class)
 public class XmlJsonDataFormatAutoConfiguration {
 
-    @Bean(name = "xmljson-dataformat")
-    @Scope("prototype")
+    @Bean(name = "xmljson-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(XmlJsonDataFormat.class)
-    public XmlJsonDataFormat configureXmlJsonDataFormat(
-            CamelContext camelContext,
-            XmlJsonDataFormatConfiguration configuration) throws Exception {
-        XmlJsonDataFormat dataformat = new XmlJsonDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(XmlJsonDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureXmlJsonDataFormatFactory(
+            final CamelContext camelContext,
+            final XmlJsonDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                XmlJsonDataFormat dataformat = new XmlJsonDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(XmlJsonDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-xmlrpc-starter/src/main/java/org/apache/camel/dataformat/xmlrpc/springboot/XmlRpcDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-xmlrpc-starter/src/main/java/org/apache/camel/dataformat/xmlrpc/springboot/XmlRpcDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-xmlrpc-starter/src/main/java/org/apache/camel/dataformat/xmlrpc/springboot/XmlRpcDataFormatAutoConfiguration.java
index f8c75a6..79d2439 100644
--- a/platforms/spring-boot/components-starter/camel-xmlrpc-starter/src/main/java/org/apache/camel/dataformat/xmlrpc/springboot/XmlRpcDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-xmlrpc-starter/src/main/java/org/apache/camel/dataformat/xmlrpc/springboot/XmlRpcDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.xmlrpc.XmlRpcDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,27 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(XmlRpcDataFormatConfiguration.class)
 public class XmlRpcDataFormatAutoConfiguration {
 
-    @Bean(name = "xmlrpc-dataformat")
-    @Scope("prototype")
+    @Bean(name = "xmlrpc-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(XmlRpcDataFormat.class)
-    public XmlRpcDataFormat configureXmlRpcDataFormat(
-            CamelContext camelContext,
-            XmlRpcDataFormatConfiguration configuration) throws Exception {
-        XmlRpcDataFormat dataformat = new XmlRpcDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(XmlRpcDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureXmlRpcDataFormatFactory(
+            final CamelContext camelContext,
+            final XmlRpcDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                XmlRpcDataFormat dataformat = new XmlRpcDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(XmlRpcDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-xmlsecurity-starter/src/main/java/org/apache/camel/dataformat/xmlsecurity/springboot/XMLSecurityDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-xmlsecurity-starter/src/main/java/org/apache/camel/dataformat/xmlsecurity/springboot/XMLSecurityDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-xmlsecurity-starter/src/main/java/org/apache/camel/dataformat/xmlsecurity/springboot/XMLSecurityDataFormatAutoConfiguration.java
index bb55452..62ca4d5 100644
--- a/platforms/spring-boot/components-starter/camel-xmlsecurity-starter/src/main/java/org/apache/camel/dataformat/xmlsecurity/springboot/XMLSecurityDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-xmlsecurity-starter/src/main/java/org/apache/camel/dataformat/xmlsecurity/springboot/XMLSecurityDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.xmlsecurity.XMLSecurityDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,28 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(XMLSecurityDataFormatConfiguration.class)
 public class XMLSecurityDataFormatAutoConfiguration {
 
-    @Bean(name = "secureXML-dataformat")
-    @Scope("prototype")
+    @Bean(name = "secureXML-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(XMLSecurityDataFormat.class)
-    public XMLSecurityDataFormat configureXMLSecurityDataFormat(
-            CamelContext camelContext,
-            XMLSecurityDataFormatConfiguration configuration) throws Exception {
-        XMLSecurityDataFormat dataformat = new XMLSecurityDataFormat();
-        if (CamelContextAware.class
-                .isAssignableFrom(XMLSecurityDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureXMLSecurityDataFormatFactory(
+            final CamelContext camelContext,
+            final XMLSecurityDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                XMLSecurityDataFormat dataformat = new XMLSecurityDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(XMLSecurityDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/JsonDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/JsonDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/JsonDataFormatAutoConfiguration.java
index 325c7b7..b45b669 100644
--- a/platforms/spring-boot/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/JsonDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/JsonDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.xstream.JsonDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,26 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(JsonDataFormatConfiguration.class)
 public class JsonDataFormatAutoConfiguration {
 
-    @Bean(name = "json-xstream-dataformat")
-    @Scope("prototype")
+    @Bean(name = "json-xstream-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(JsonDataFormat.class)
-    public JsonDataFormat configureJsonDataFormat(CamelContext camelContext,
-            JsonDataFormatConfiguration configuration) throws Exception {
-        JsonDataFormat dataformat = new JsonDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(JsonDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureJsonDataFormatFactory(
+            final CamelContext camelContext,
+            final JsonDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                JsonDataFormat dataformat = new JsonDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(JsonDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/XStreamDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/XStreamDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/XStreamDataFormatAutoConfiguration.java
index d75f8b6..c132cab 100644
--- a/platforms/spring-boot/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/XStreamDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/XStreamDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.xstream.XStreamDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,27 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(XStreamDataFormatConfiguration.class)
 public class XStreamDataFormatAutoConfiguration {
 
-    @Bean(name = "xstream-dataformat")
-    @Scope("prototype")
+    @Bean(name = "xstream-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(XStreamDataFormat.class)
-    public XStreamDataFormat configureXStreamDataFormat(
-            CamelContext camelContext,
-            XStreamDataFormatConfiguration configuration) throws Exception {
-        XStreamDataFormat dataformat = new XStreamDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(XStreamDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureXStreamDataFormatFactory(
+            final CamelContext camelContext,
+            final XStreamDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                XStreamDataFormat dataformat = new XStreamDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(XStreamDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-zipfile-starter/src/main/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-zipfile-starter/src/main/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-zipfile-starter/src/main/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileDataFormatAutoConfiguration.java
index 50ef0a8..a0a3213 100644
--- a/platforms/spring-boot/components-starter/camel-zipfile-starter/src/main/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-zipfile-starter/src/main/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.zipfile.ZipFileDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,27 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(ZipFileDataFormatConfiguration.class)
 public class ZipFileDataFormatAutoConfiguration {
 
-    @Bean(name = "zipfile-dataformat")
-    @Scope("prototype")
+    @Bean(name = "zipfile-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(ZipFileDataFormat.class)
-    public ZipFileDataFormat configureZipFileDataFormat(
-            CamelContext camelContext,
-            ZipFileDataFormatConfiguration configuration) throws Exception {
-        ZipFileDataFormat dataformat = new ZipFileDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(ZipFileDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureZipFileDataFormatFactory(
+            final CamelContext camelContext,
+            final ZipFileDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                ZipFileDataFormat dataformat = new ZipFileDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(ZipFileDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
index f8651ed..3ad7332 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
@@ -885,29 +885,30 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
         javaClass.addImport("org.apache.camel.CamelContextAware");
         javaClass.addImport(model.getJavaType());
         javaClass.addImport("org.apache.camel.CamelContext");
+        javaClass.addImport("org.apache.camel.RuntimeCamelException");
+        javaClass.addImport("org.apache.camel.spi.DataFormat");
+        javaClass.addImport("org.apache.camel.spi.DataFormatFactory");
 
         String body = createDataFormatBody(model.getShortJavaType(), hasOptions);
-        String methodName = "configure" + model.getShortJavaType();
+        String methodName = "configure" + model.getShortJavaType() + "Factory";
 
         MethodSource<JavaClassSource> method = javaClass.addMethod()
                 .setName(methodName)
                 .setPublic()
                 .setBody(body)
-                .setReturnType(model.getShortJavaType())
-                .addThrows(Exception.class);
+                .setReturnType("org.apache.camel.spi.DataFormatFactory");
 
-        method.addParameter("CamelContext", "camelContext");
+        method.addParameter("CamelContext", "camelContext").setFinal(true);
 
         if (hasOptions) {
-            method.addParameter(configurationName, "configuration");
+            method.addParameter(configurationName, "configuration").setFinal(true);
         }
 
         // Determine all the aliases
         // adding the '-dataformat' suffix to prevent collision with component names
-        String[] springBeanAliases = dataFormatAliases.stream().map(alias -> alias + "-dataformat").toArray(size -> new String[size]);
+        String[] springBeanAliases = dataFormatAliases.stream().map(alias -> alias + "-dataformat-factory").toArray(size -> new String[size]);
 
         method.addAnnotation(Bean.class).setStringArrayValue("name", springBeanAliases);
-        method.addAnnotation(Scope.class).setStringValue("prototype");
         method.addAnnotation(ConditionalOnClass.class).setLiteralValue("value", "CamelContext.class");
         method.addAnnotation(ConditionalOnMissingBean.class).setLiteralValue("value", model.getShortJavaType() + ".class");
 
@@ -1059,22 +1060,29 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
 
     private static String createDataFormatBody(String shortJavaType, boolean hasOptions) {
         StringBuilder sb = new StringBuilder();
-        sb.append(shortJavaType).append(" dataformat = new ").append(shortJavaType).append("();").append("\n");
-        sb.append("if (CamelContextAware.class.isAssignableFrom(").append(shortJavaType).append(".class)) {\n");
-        sb.append("    CamelContextAware contextAware = CamelContextAware.class.cast(dataformat);\n");
-        sb.append("    if (contextAware != null) {\n");
-        sb.append("        contextAware.setCamelContext(camelContext);\n");
-        sb.append("    }\n");
-        sb.append("}\n");
+        sb.append("return new DataFormatFactory() {\n");
+        sb.append("    public DataFormat newInstance() {\n");
+        sb.append("        ").append(shortJavaType).append(" dataformat = new ").append(shortJavaType).append("();").append("\n");
+        sb.append("        if (CamelContextAware.class.isAssignableFrom(").append(shortJavaType).append(".class)) {\n");
+        sb.append("            CamelContextAware contextAware = CamelContextAware.class.cast(dataformat);\n");
+        sb.append("            if (contextAware != null) {\n");
+        sb.append("                contextAware.setCamelContext(camelContext);\n");
+        sb.append("            }\n");
+        sb.append("        }\n");
         if (hasOptions) {
             sb.append("\n");
-            sb.append("Map<String, Object> parameters = new HashMap<>();\n");
-            sb.append("IntrospectionSupport.getProperties(configuration, parameters, null, false);\n");
-            sb.append("\n");
-            sb.append("IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), dataformat, parameters);\n");
+            sb.append("        try {\n");
+            sb.append("            Map<String, Object> parameters = new HashMap<>();\n");
+            sb.append("            IntrospectionSupport.getProperties(configuration, parameters, null, false);\n");
+            sb.append("            IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), dataformat, parameters);\n");
+            sb.append("        } catch (Exception e) {\n");
+            sb.append("            throw new RuntimeCamelException(e);\n");
+            sb.append("        }\n");
         }
         sb.append("\n");
-        sb.append("return dataformat;");
+        sb.append("        return dataformat;\n");
+        sb.append("    }\n");
+        sb.append("};\n");
         return sb.toString();
     }
 


[2/3] camel git commit: CAMEL-10542: DataFormat from registry is used for every dataformat operation (marshal/unmarshal)

Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/GzipDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/GzipDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/GzipDataFormatAutoConfiguration.java
index 91b952c..81c052e 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/GzipDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/GzipDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.impl.GzipDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,26 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(GzipDataFormatConfiguration.class)
 public class GzipDataFormatAutoConfiguration {
 
-    @Bean(name = "gzip-dataformat")
-    @Scope("prototype")
+    @Bean(name = "gzip-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(GzipDataFormat.class)
-    public GzipDataFormat configureGzipDataFormat(CamelContext camelContext,
-            GzipDataFormatConfiguration configuration) throws Exception {
-        GzipDataFormat dataformat = new GzipDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(GzipDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureGzipDataFormatFactory(
+            final CamelContext camelContext,
+            final GzipDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                GzipDataFormat dataformat = new GzipDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(GzipDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/SerializationDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/SerializationDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/SerializationDataFormatAutoConfiguration.java
index b19cd1d..27f6dbb 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/SerializationDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/SerializationDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.impl.SerializationDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,29 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(SerializationDataFormatConfiguration.class)
 public class SerializationDataFormatAutoConfiguration {
 
-    @Bean(name = "serialization-dataformat")
-    @Scope("prototype")
+    @Bean(name = "serialization-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(SerializationDataFormat.class)
-    public SerializationDataFormat configureSerializationDataFormat(
-            CamelContext camelContext,
-            SerializationDataFormatConfiguration configuration)
-            throws Exception {
-        SerializationDataFormat dataformat = new SerializationDataFormat();
-        if (CamelContextAware.class
-                .isAssignableFrom(SerializationDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureSerializationDataFormatFactory(
+            final CamelContext camelContext,
+            final SerializationDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                SerializationDataFormat dataformat = new SerializationDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(SerializationDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/StringDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/StringDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/StringDataFormatAutoConfiguration.java
index e3ebb70..d699e97 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/StringDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/StringDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.impl.StringDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,27 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(StringDataFormatConfiguration.class)
 public class StringDataFormatAutoConfiguration {
 
-    @Bean(name = "string-dataformat")
-    @Scope("prototype")
+    @Bean(name = "string-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(StringDataFormat.class)
-    public StringDataFormat configureStringDataFormat(
-            CamelContext camelContext,
-            StringDataFormatConfiguration configuration) throws Exception {
-        StringDataFormat dataformat = new StringDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(StringDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureStringDataFormatFactory(
+            final CamelContext camelContext,
+            final StringDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                StringDataFormat dataformat = new StringDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(StringDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/ZipDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/ZipDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/ZipDataFormatAutoConfiguration.java
index 992c168..26ea5fe 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/ZipDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/ZipDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.impl.ZipDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,26 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(ZipDataFormatConfiguration.class)
 public class ZipDataFormatAutoConfiguration {
 
-    @Bean(name = "zip-dataformat")
-    @Scope("prototype")
+    @Bean(name = "zip-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(ZipDataFormat.class)
-    public ZipDataFormat configureZipDataFormat(CamelContext camelContext,
-            ZipDataFormatConfiguration configuration) throws Exception {
-        ZipDataFormat dataformat = new ZipDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(ZipDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureZipDataFormatFactory(
+            final CamelContext camelContext,
+            final ZipDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                ZipDataFormat dataformat = new ZipDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(ZipDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/CryptoDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/CryptoDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/CryptoDataFormatAutoConfiguration.java
index 3837a72..4b13322 100644
--- a/platforms/spring-boot/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/CryptoDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/CryptoDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.converter.crypto.CryptoDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,27 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(CryptoDataFormatConfiguration.class)
 public class CryptoDataFormatAutoConfiguration {
 
-    @Bean(name = "crypto-dataformat")
-    @Scope("prototype")
+    @Bean(name = "crypto-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(CryptoDataFormat.class)
-    public CryptoDataFormat configureCryptoDataFormat(
-            CamelContext camelContext,
-            CryptoDataFormatConfiguration configuration) throws Exception {
-        CryptoDataFormat dataformat = new CryptoDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(CryptoDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureCryptoDataFormatFactory(
+            final CamelContext camelContext,
+            final CryptoDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                CryptoDataFormat dataformat = new CryptoDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(CryptoDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/PGPDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/PGPDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/PGPDataFormatAutoConfiguration.java
index 5df0116..8dd787a 100644
--- a/platforms/spring-boot/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/PGPDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/PGPDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.converter.crypto.PGPDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,26 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(PGPDataFormatConfiguration.class)
 public class PGPDataFormatAutoConfiguration {
 
-    @Bean(name = "pgp-dataformat")
-    @Scope("prototype")
+    @Bean(name = "pgp-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(PGPDataFormat.class)
-    public PGPDataFormat configurePGPDataFormat(CamelContext camelContext,
-            PGPDataFormatConfiguration configuration) throws Exception {
-        PGPDataFormat dataformat = new PGPDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(PGPDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configurePGPDataFormatFactory(
+            final CamelContext camelContext,
+            final PGPDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                PGPDataFormat dataformat = new PGPDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(PGPDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-csv-starter/src/main/java/org/apache/camel/dataformat/csv/springboot/CsvDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-csv-starter/src/main/java/org/apache/camel/dataformat/csv/springboot/CsvDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-csv-starter/src/main/java/org/apache/camel/dataformat/csv/springboot/CsvDataFormatAutoConfiguration.java
index 15298a3..0eccf24 100644
--- a/platforms/spring-boot/components-starter/camel-csv-starter/src/main/java/org/apache/camel/dataformat/csv/springboot/CsvDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-csv-starter/src/main/java/org/apache/camel/dataformat/csv/springboot/CsvDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.csv.CsvDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,26 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(CsvDataFormatConfiguration.class)
 public class CsvDataFormatAutoConfiguration {
 
-    @Bean(name = "csv-dataformat")
-    @Scope("prototype")
+    @Bean(name = "csv-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(CsvDataFormat.class)
-    public CsvDataFormat configureCsvDataFormat(CamelContext camelContext,
-            CsvDataFormatConfiguration configuration) throws Exception {
-        CsvDataFormat dataformat = new CsvDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(CsvDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureCsvDataFormatFactory(
+            final CamelContext camelContext,
+            final CsvDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                CsvDataFormat dataformat = new CsvDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(CsvDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-flatpack-starter/src/main/java/org/apache/camel/dataformat/flatpack/springboot/FlatpackDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-flatpack-starter/src/main/java/org/apache/camel/dataformat/flatpack/springboot/FlatpackDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-flatpack-starter/src/main/java/org/apache/camel/dataformat/flatpack/springboot/FlatpackDataFormatAutoConfiguration.java
index 04c4ed4..ce9a747 100644
--- a/platforms/spring-boot/components-starter/camel-flatpack-starter/src/main/java/org/apache/camel/dataformat/flatpack/springboot/FlatpackDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-flatpack-starter/src/main/java/org/apache/camel/dataformat/flatpack/springboot/FlatpackDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.flatpack.FlatpackDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,27 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(FlatpackDataFormatConfiguration.class)
 public class FlatpackDataFormatAutoConfiguration {
 
-    @Bean(name = "flatpack-dataformat")
-    @Scope("prototype")
+    @Bean(name = "flatpack-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(FlatpackDataFormat.class)
-    public FlatpackDataFormat configureFlatpackDataFormat(
-            CamelContext camelContext,
-            FlatpackDataFormatConfiguration configuration) throws Exception {
-        FlatpackDataFormat dataformat = new FlatpackDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(FlatpackDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureFlatpackDataFormatFactory(
+            final CamelContext camelContext,
+            final FlatpackDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                FlatpackDataFormat dataformat = new FlatpackDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(FlatpackDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-gson-starter/src/main/java/org/apache/camel/component/gson/springboot/GsonDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-gson-starter/src/main/java/org/apache/camel/component/gson/springboot/GsonDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-gson-starter/src/main/java/org/apache/camel/component/gson/springboot/GsonDataFormatAutoConfiguration.java
index 1e70c02..97122f2 100644
--- a/platforms/spring-boot/components-starter/camel-gson-starter/src/main/java/org/apache/camel/component/gson/springboot/GsonDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-gson-starter/src/main/java/org/apache/camel/component/gson/springboot/GsonDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.component.gson.GsonDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,26 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(GsonDataFormatConfiguration.class)
 public class GsonDataFormatAutoConfiguration {
 
-    @Bean(name = "json-gson-dataformat")
-    @Scope("prototype")
+    @Bean(name = "json-gson-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(GsonDataFormat.class)
-    public GsonDataFormat configureGsonDataFormat(CamelContext camelContext,
-            GsonDataFormatConfiguration configuration) throws Exception {
-        GsonDataFormat dataformat = new GsonDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(GsonDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureGsonDataFormatFactory(
+            final CamelContext camelContext,
+            final GsonDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                GsonDataFormat dataformat = new GsonDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(GsonDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-hessian-starter/src/main/java/org/apache/camel/dataformat/hessian/springboot/HessianDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hessian-starter/src/main/java/org/apache/camel/dataformat/hessian/springboot/HessianDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hessian-starter/src/main/java/org/apache/camel/dataformat/hessian/springboot/HessianDataFormatAutoConfiguration.java
index 17546ea..11c817e 100644
--- a/platforms/spring-boot/components-starter/camel-hessian-starter/src/main/java/org/apache/camel/dataformat/hessian/springboot/HessianDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hessian-starter/src/main/java/org/apache/camel/dataformat/hessian/springboot/HessianDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.hessian.HessianDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,27 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(HessianDataFormatConfiguration.class)
 public class HessianDataFormatAutoConfiguration {
 
-    @Bean(name = "hessian-dataformat")
-    @Scope("prototype")
+    @Bean(name = "hessian-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(HessianDataFormat.class)
-    public HessianDataFormat configureHessianDataFormat(
-            CamelContext camelContext,
-            HessianDataFormatConfiguration configuration) throws Exception {
-        HessianDataFormat dataformat = new HessianDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(HessianDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureHessianDataFormatFactory(
+            final CamelContext camelContext,
+            final HessianDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                HessianDataFormat dataformat = new HessianDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(HessianDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/HL7DataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/HL7DataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/HL7DataFormatAutoConfiguration.java
index fdf2b1d..55a1bed 100644
--- a/platforms/spring-boot/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/HL7DataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/HL7DataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.component.hl7.HL7DataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,26 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(HL7DataFormatConfiguration.class)
 public class HL7DataFormatAutoConfiguration {
 
-    @Bean(name = "hl7-dataformat")
-    @Scope("prototype")
+    @Bean(name = "hl7-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(HL7DataFormat.class)
-    public HL7DataFormat configureHL7DataFormat(CamelContext camelContext,
-            HL7DataFormatConfiguration configuration) throws Exception {
-        HL7DataFormat dataformat = new HL7DataFormat();
-        if (CamelContextAware.class.isAssignableFrom(HL7DataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureHL7DataFormatFactory(
+            final CamelContext camelContext,
+            final HL7DataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                HL7DataFormat dataformat = new HL7DataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(HL7DataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-ical-starter/src/main/java/org/apache/camel/component/ical/springboot/ICalDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ical-starter/src/main/java/org/apache/camel/component/ical/springboot/ICalDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ical-starter/src/main/java/org/apache/camel/component/ical/springboot/ICalDataFormatAutoConfiguration.java
index 3943c8f..b799b7d 100644
--- a/platforms/spring-boot/components-starter/camel-ical-starter/src/main/java/org/apache/camel/component/ical/springboot/ICalDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-ical-starter/src/main/java/org/apache/camel/component/ical/springboot/ICalDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.component.ical.ICalDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,26 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(ICalDataFormatConfiguration.class)
 public class ICalDataFormatAutoConfiguration {
 
-    @Bean(name = "ical-dataformat")
-    @Scope("prototype")
+    @Bean(name = "ical-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(ICalDataFormat.class)
-    public ICalDataFormat configureICalDataFormat(CamelContext camelContext,
-            ICalDataFormatConfiguration configuration) throws Exception {
-        ICalDataFormat dataformat = new ICalDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(ICalDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureICalDataFormatFactory(
+            final CamelContext camelContext,
+            final ICalDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                ICalDataFormat dataformat = new ICalDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(ICalDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatAutoConfiguration.java
index f75f042..406b5af 100644
--- a/platforms/spring-boot/components-starter/camel-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.component.jackson.JacksonDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,27 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(JacksonDataFormatConfiguration.class)
 public class JacksonDataFormatAutoConfiguration {
 
-    @Bean(name = "json-jackson-dataformat")
-    @Scope("prototype")
+    @Bean(name = "json-jackson-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(JacksonDataFormat.class)
-    public JacksonDataFormat configureJacksonDataFormat(
-            CamelContext camelContext,
-            JacksonDataFormatConfiguration configuration) throws Exception {
-        JacksonDataFormat dataformat = new JacksonDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(JacksonDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureJacksonDataFormatFactory(
+            final CamelContext camelContext,
+            final JacksonDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                JacksonDataFormat dataformat = new JacksonDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(JacksonDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-jacksonxml-starter/src/main/java/org/apache/camel/component/jacksonxml/springboot/JacksonXMLDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jacksonxml-starter/src/main/java/org/apache/camel/component/jacksonxml/springboot/JacksonXMLDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jacksonxml-starter/src/main/java/org/apache/camel/component/jacksonxml/springboot/JacksonXMLDataFormatAutoConfiguration.java
index 0061a0c..30c2f63 100644
--- a/platforms/spring-boot/components-starter/camel-jacksonxml-starter/src/main/java/org/apache/camel/component/jacksonxml/springboot/JacksonXMLDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jacksonxml-starter/src/main/java/org/apache/camel/component/jacksonxml/springboot/JacksonXMLDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.component.jacksonxml.JacksonXMLDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,28 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(JacksonXMLDataFormatConfiguration.class)
 public class JacksonXMLDataFormatAutoConfiguration {
 
-    @Bean(name = "jacksonxml-dataformat")
-    @Scope("prototype")
+    @Bean(name = "jacksonxml-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(JacksonXMLDataFormat.class)
-    public JacksonXMLDataFormat configureJacksonXMLDataFormat(
-            CamelContext camelContext,
-            JacksonXMLDataFormatConfiguration configuration) throws Exception {
-        JacksonXMLDataFormat dataformat = new JacksonXMLDataFormat();
-        if (CamelContextAware.class
-                .isAssignableFrom(JacksonXMLDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureJacksonXMLDataFormatFactory(
+            final CamelContext camelContext,
+            final JacksonXMLDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                JacksonXMLDataFormat dataformat = new JacksonXMLDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(JacksonXMLDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-jaxb-starter/src/main/java/org/apache/camel/converter/jaxb/springboot/JaxbDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jaxb-starter/src/main/java/org/apache/camel/converter/jaxb/springboot/JaxbDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jaxb-starter/src/main/java/org/apache/camel/converter/jaxb/springboot/JaxbDataFormatAutoConfiguration.java
index 23aa3c1..3562119 100644
--- a/platforms/spring-boot/components-starter/camel-jaxb-starter/src/main/java/org/apache/camel/converter/jaxb/springboot/JaxbDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jaxb-starter/src/main/java/org/apache/camel/converter/jaxb/springboot/JaxbDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.converter.jaxb.JaxbDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,26 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(JaxbDataFormatConfiguration.class)
 public class JaxbDataFormatAutoConfiguration {
 
-    @Bean(name = "jaxb-dataformat")
-    @Scope("prototype")
+    @Bean(name = "jaxb-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(JaxbDataFormat.class)
-    public JaxbDataFormat configureJaxbDataFormat(CamelContext camelContext,
-            JaxbDataFormatConfiguration configuration) throws Exception {
-        JaxbDataFormat dataformat = new JaxbDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(JaxbDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureJaxbDataFormatFactory(
+            final CamelContext camelContext,
+            final JaxbDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                JaxbDataFormat dataformat = new JaxbDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(JaxbDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-jibx-starter/src/main/java/org/apache/camel/dataformat/jibx/springboot/JibxDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jibx-starter/src/main/java/org/apache/camel/dataformat/jibx/springboot/JibxDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jibx-starter/src/main/java/org/apache/camel/dataformat/jibx/springboot/JibxDataFormatAutoConfiguration.java
index 7842ce0..179701a 100644
--- a/platforms/spring-boot/components-starter/camel-jibx-starter/src/main/java/org/apache/camel/dataformat/jibx/springboot/JibxDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jibx-starter/src/main/java/org/apache/camel/dataformat/jibx/springboot/JibxDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.jibx.JibxDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,26 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(JibxDataFormatConfiguration.class)
 public class JibxDataFormatAutoConfiguration {
 
-    @Bean(name = "jibx-dataformat")
-    @Scope("prototype")
+    @Bean(name = "jibx-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(JibxDataFormat.class)
-    public JibxDataFormat configureJibxDataFormat(CamelContext camelContext,
-            JibxDataFormatConfiguration configuration) throws Exception {
-        JibxDataFormat dataformat = new JibxDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(JibxDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureJibxDataFormatFactory(
+            final CamelContext camelContext,
+            final JibxDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                JibxDataFormat dataformat = new JibxDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(JibxDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-johnzon-starter/src/main/java/org/apache/camel/component/johnzon/springboot/JohnzonDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-johnzon-starter/src/main/java/org/apache/camel/component/johnzon/springboot/JohnzonDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-johnzon-starter/src/main/java/org/apache/camel/component/johnzon/springboot/JohnzonDataFormatAutoConfiguration.java
index 43e9e9a..0f5d2e0 100644
--- a/platforms/spring-boot/components-starter/camel-johnzon-starter/src/main/java/org/apache/camel/component/johnzon/springboot/JohnzonDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-johnzon-starter/src/main/java/org/apache/camel/component/johnzon/springboot/JohnzonDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.component.johnzon.JohnzonDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,27 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(JohnzonDataFormatConfiguration.class)
 public class JohnzonDataFormatAutoConfiguration {
 
-    @Bean(name = "json-johnzon-dataformat")
-    @Scope("prototype")
+    @Bean(name = "json-johnzon-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(JohnzonDataFormat.class)
-    public JohnzonDataFormat configureJohnzonDataFormat(
-            CamelContext camelContext,
-            JohnzonDataFormatConfiguration configuration) throws Exception {
-        JohnzonDataFormat dataformat = new JohnzonDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(JohnzonDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureJohnzonDataFormatFactory(
+            final CamelContext camelContext,
+            final JohnzonDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                JohnzonDataFormat dataformat = new JohnzonDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(JohnzonDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-lzf-starter/src/main/java/org/apache/camel/dataformat/lzf/springboot/LZFDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-lzf-starter/src/main/java/org/apache/camel/dataformat/lzf/springboot/LZFDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-lzf-starter/src/main/java/org/apache/camel/dataformat/lzf/springboot/LZFDataFormatAutoConfiguration.java
index 213ebd1..fdffdef 100644
--- a/platforms/spring-boot/components-starter/camel-lzf-starter/src/main/java/org/apache/camel/dataformat/lzf/springboot/LZFDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-lzf-starter/src/main/java/org/apache/camel/dataformat/lzf/springboot/LZFDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.lzf.LZFDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,26 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(LZFDataFormatConfiguration.class)
 public class LZFDataFormatAutoConfiguration {
 
-    @Bean(name = "lzf-dataformat")
-    @Scope("prototype")
+    @Bean(name = "lzf-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(LZFDataFormat.class)
-    public LZFDataFormat configureLZFDataFormat(CamelContext camelContext,
-            LZFDataFormatConfiguration configuration) throws Exception {
-        LZFDataFormat dataformat = new LZFDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(LZFDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureLZFDataFormatFactory(
+            final CamelContext camelContext,
+            final LZFDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                LZFDataFormat dataformat = new LZFDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(LZFDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-mail-starter/src/main/java/org/apache/camel/dataformat/mime/multipart/springboot/MimeMultipartDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-mail-starter/src/main/java/org/apache/camel/dataformat/mime/multipart/springboot/MimeMultipartDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-mail-starter/src/main/java/org/apache/camel/dataformat/mime/multipart/springboot/MimeMultipartDataFormatAutoConfiguration.java
index a1e1197..3e97726 100644
--- a/platforms/spring-boot/components-starter/camel-mail-starter/src/main/java/org/apache/camel/dataformat/mime/multipart/springboot/MimeMultipartDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-mail-starter/src/main/java/org/apache/camel/dataformat/mime/multipart/springboot/MimeMultipartDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.mime.multipart.MimeMultipartDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,29 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(MimeMultipartDataFormatConfiguration.class)
 public class MimeMultipartDataFormatAutoConfiguration {
 
-    @Bean(name = "mime-multipart-dataformat")
-    @Scope("prototype")
+    @Bean(name = "mime-multipart-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(MimeMultipartDataFormat.class)
-    public MimeMultipartDataFormat configureMimeMultipartDataFormat(
-            CamelContext camelContext,
-            MimeMultipartDataFormatConfiguration configuration)
-            throws Exception {
-        MimeMultipartDataFormat dataformat = new MimeMultipartDataFormat();
-        if (CamelContextAware.class
-                .isAssignableFrom(MimeMultipartDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureMimeMultipartDataFormatFactory(
+            final CamelContext camelContext,
+            final MimeMultipartDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                MimeMultipartDataFormat dataformat = new MimeMultipartDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(MimeMultipartDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {


[3/3] camel git commit: CAMEL-10542: DataFormat from registry is used for every dataformat operation (marshal/unmarshal)

Posted by lb...@apache.org.
CAMEL-10542: DataFormat from registry is used for every dataformat operation (marshal/unmarshal)


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c0a9f5cd
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c0a9f5cd
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c0a9f5cd

Branch: refs/heads/master
Commit: c0a9f5cd494a361c081ded85c5b23f4c903a78a3
Parents: d4c4a84
Author: lburgazzoli <lb...@gmail.com>
Authored: Fri Dec 2 17:38:55 2016 +0100
Committer: lburgazzoli <lb...@gmail.com>
Committed: Wed Feb 1 11:38:35 2017 +0100

----------------------------------------------------------------------
 .../java/org/apache/camel/CamelContext.java     |  8 +++
 .../dataformat/DataFormatComponent.java         |  6 ++
 .../dataformat/DataFormatEndpoint.java          | 22 +++---
 .../apache/camel/impl/DefaultCamelContext.java  | 11 +++
 .../camel/impl/DefaultDataFormatResolver.java   | 70 ++++++++++++++------
 .../org/apache/camel/impl/osgi/Activator.java   | 12 ++++
 .../camel/model/DataFormatDefinition.java       |  2 +-
 .../org/apache/camel/spi/DataFormatFactory.java | 31 +++++++++
 .../apache/camel/spi/DataFormatResolver.java    |  9 ++-
 .../org/apache/camel/util/ResolverHelper.java   | 19 ++++++
 .../camel/processor/DataFormatFactoryTest.java  | 53 +++++++++++++++
 .../blueprint/BlueprintDataFormatResolver.java  | 33 ++++++---
 .../camel/core/osgi/OsgiDataFormatResolver.java | 45 +++++++++----
 .../csv/CsvDataFormatCustomFactoryTest.java     | 58 ++++++++++++++++
 .../csv/CsvDataFormatResourceFactoryTest.java   | 57 ++++++++++++++++
 .../dataformat/csv/MyCsvDataFormatFactory.java  | 37 +++++++++++
 .../CsvDataFormatCustomFactoryTest-context.xml  | 46 +++++++++++++
 ...CsvDataFormatResourceFactoryTest-context.xml | 44 ++++++++++++
 .../AvroDataFormatAutoConfiguration.java        | 48 +++++++++-----
 .../BarcodeDataFormatAutoConfiguration.java     | 49 ++++++++------
 .../Base64DataFormatAutoConfiguration.java      | 49 ++++++++------
 .../BeanIODataFormatAutoConfiguration.java      | 49 ++++++++------
 .../BindyCsvDataFormatAutoConfiguration.java    | 49 ++++++++------
 ...yFixedLengthDataFormatAutoConfiguration.java | 51 ++++++++------
 ...KeyValuePairDataFormatAutoConfiguration.java | 51 ++++++++------
 .../BoonDataFormatAutoConfiguration.java        | 48 +++++++++-----
 .../CastorDataFormatAutoConfiguration.java      | 49 ++++++++------
 .../GzipDataFormatAutoConfiguration.java        | 48 +++++++++-----
 ...erializationDataFormatAutoConfiguration.java | 51 ++++++++------
 .../StringDataFormatAutoConfiguration.java      | 49 ++++++++------
 .../ZipDataFormatAutoConfiguration.java         | 48 +++++++++-----
 .../CryptoDataFormatAutoConfiguration.java      | 49 ++++++++------
 .../PGPDataFormatAutoConfiguration.java         | 48 +++++++++-----
 .../CsvDataFormatAutoConfiguration.java         | 48 +++++++++-----
 .../FlatpackDataFormatAutoConfiguration.java    | 49 ++++++++------
 .../GsonDataFormatAutoConfiguration.java        | 48 +++++++++-----
 .../HessianDataFormatAutoConfiguration.java     | 49 ++++++++------
 .../HL7DataFormatAutoConfiguration.java         | 48 +++++++++-----
 .../ICalDataFormatAutoConfiguration.java        | 48 +++++++++-----
 .../JacksonDataFormatAutoConfiguration.java     | 49 ++++++++------
 .../JacksonXMLDataFormatAutoConfiguration.java  | 50 ++++++++------
 .../JaxbDataFormatAutoConfiguration.java        | 48 +++++++++-----
 .../JibxDataFormatAutoConfiguration.java        | 48 +++++++++-----
 .../JohnzonDataFormatAutoConfiguration.java     | 49 ++++++++------
 .../LZFDataFormatAutoConfiguration.java         | 48 +++++++++-----
 ...imeMultipartDataFormatAutoConfiguration.java | 51 ++++++++------
 .../ProtobufDataFormatAutoConfiguration.java    | 49 ++++++++------
 .../RssDataFormatAutoConfiguration.java         | 48 +++++++++-----
 .../SnakeYAMLDataFormatAutoConfiguration.java   | 49 ++++++++------
 .../SoapJaxbDataFormatAutoConfiguration.java    | 49 ++++++++------
 .../SyslogDataFormatAutoConfiguration.java      | 49 ++++++++------
 .../TidyMarkupDataFormatAutoConfiguration.java  | 50 ++++++++------
 .../TarFileDataFormatAutoConfiguration.java     | 49 ++++++++------
 ...UniVocityCsvDataFormatAutoConfiguration.java | 50 ++++++++------
 ...tyFixedWidthDataFormatAutoConfiguration.java | 51 ++++++++------
 ...UniVocityTsvDataFormatAutoConfiguration.java | 50 ++++++++------
 .../XmlBeansDataFormatAutoConfiguration.java    | 49 ++++++++------
 .../XmlJsonDataFormatAutoConfiguration.java     | 49 ++++++++------
 .../XmlRpcDataFormatAutoConfiguration.java      | 49 ++++++++------
 .../XMLSecurityDataFormatAutoConfiguration.java | 50 ++++++++------
 .../JsonDataFormatAutoConfiguration.java        | 48 +++++++++-----
 .../XStreamDataFormatAutoConfiguration.java     | 49 ++++++++------
 .../ZipFileDataFormatAutoConfiguration.java     | 49 ++++++++------
 .../SpringBootAutoConfigurationMojo.java        | 46 +++++++------
 64 files changed, 1884 insertions(+), 931 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/camel-core/src/main/java/org/apache/camel/CamelContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/CamelContext.java b/camel-core/src/main/java/org/apache/camel/CamelContext.java
index 597b685..b0ea66b 100644
--- a/camel-core/src/main/java/org/apache/camel/CamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/CamelContext.java
@@ -1206,6 +1206,14 @@ public interface CamelContext extends SuspendableService, RuntimeConfiguration {
     DataFormat resolveDataFormat(String name);
 
     /**
+     * Creates the given data format given its name.
+     *
+     * @param name the data format name or a reference to a data format factory in the {@link Registry}
+     * @return the resolved data format, or <tt>null</tt> if not found
+     */
+    DataFormat createDataFormat(String name);
+
+    /**
      * Resolve a data format definition given its name
      *
      * @param name the data format definition name or a reference to it in the {@link Registry}

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/camel-core/src/main/java/org/apache/camel/component/dataformat/DataFormatComponent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/dataformat/DataFormatComponent.java b/camel-core/src/main/java/org/apache/camel/component/dataformat/DataFormatComponent.java
index 692b831..9aee141 100644
--- a/camel-core/src/main/java/org/apache/camel/component/dataformat/DataFormatComponent.java
+++ b/camel-core/src/main/java/org/apache/camel/component/dataformat/DataFormatComponent.java
@@ -38,8 +38,14 @@ public class DataFormatComponent extends UriEndpointComponent {
     @Override
     protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
         String name = ObjectHelper.before(remaining, ":");
+
+        // try to lookup data format in the registry or create it from resource
         DataFormat df = getCamelContext().resolveDataFormat(name);
         if (df == null) {
+            // if not, try to find a factory in the registry
+            df = getCamelContext().createDataFormat(name);
+        }
+        if (df == null) {
             throw new IllegalArgumentException("Cannot find data format with name: " + name);
         }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/camel-core/src/main/java/org/apache/camel/component/dataformat/DataFormatEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/dataformat/DataFormatEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/dataformat/DataFormatEndpoint.java
index 441d4ed..efbf89a 100644
--- a/camel-core/src/main/java/org/apache/camel/component/dataformat/DataFormatEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/dataformat/DataFormatEndpoint.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.dataformat;
 
 import org.apache.camel.AsyncCallback;
+import org.apache.camel.AsyncProcessor;
 import org.apache.camel.Component;
 import org.apache.camel.Consumer;
 import org.apache.camel.Exchange;
@@ -39,8 +40,7 @@ import org.apache.camel.util.ServiceHelper;
         label = "core,transformation", lenientProperties = true)
 public class DataFormatEndpoint extends DefaultEndpoint {
 
-    private MarshalProcessor marshal;
-    private UnmarshalProcessor unmarshal;
+    private AsyncProcessor processor;
     private DataFormat dataFormat;
 
     @UriPath(description = "Name of data format") @Metadata(required = "true")
@@ -88,11 +88,7 @@ public class DataFormatEndpoint extends DefaultEndpoint {
         return new DefaultAsyncProducer(this) {
             @Override
             public boolean process(Exchange exchange, AsyncCallback callback) {
-                if (marshal != null) {
-                    return marshal.process(exchange, callback);
-                } else {
-                    return unmarshal.process(exchange, callback);
-                }
+                return processor.process(exchange, callback);
             }
 
             @Override
@@ -123,20 +119,24 @@ public class DataFormatEndpoint extends DefaultEndpoint {
             dataFormat = getCamelContext().resolveDataFormat(name);
         }
         if (operation.equals("marshal")) {
-            marshal = new MarshalProcessor(dataFormat);
+            MarshalProcessor marshal = new MarshalProcessor(dataFormat);
             marshal.setCamelContext(getCamelContext());
+
+            processor = marshal;
         } else {
-            unmarshal = new UnmarshalProcessor(dataFormat);
+            UnmarshalProcessor unmarshal = new UnmarshalProcessor(dataFormat);
             unmarshal.setCamelContext(getCamelContext());
+
+            processor = unmarshal;
         }
 
-        ServiceHelper.startServices(dataFormat, marshal, unmarshal);
+        ServiceHelper.startServices(dataFormat, processor);
         super.doStart();
     }
 
     @Override
     protected void doStop() throws Exception {
-        ServiceHelper.stopServices(marshal, unmarshal, dataFormat);
+        ServiceHelper.stopServices(processor, dataFormat);
         super.doStop();
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
index 94f598a..67f77ea 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
@@ -4156,6 +4156,17 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
         return answer;
     }
 
+    public DataFormat createDataFormat(String name) {
+        DataFormat answer = dataFormatResolver.createDataFormat(name, this);
+
+        // inject CamelContext if aware
+        if (answer != null && answer instanceof CamelContextAware) {
+            ((CamelContextAware) answer).setCamelContext(this);
+        }
+
+        return answer;
+    }
+
     public DataFormatDefinition resolveDataFormatDefinition(String name) {
         // lookup type and create the data format from it
         DataFormatDefinition type = lookup(this, name, DataFormatDefinition.class);

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/camel-core/src/main/java/org/apache/camel/impl/DefaultDataFormatResolver.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultDataFormatResolver.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultDataFormatResolver.java
index d777546..571799a 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultDataFormatResolver.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultDataFormatResolver.java
@@ -19,6 +19,7 @@ package org.apache.camel.impl;
 import org.apache.camel.CamelContext;
 import org.apache.camel.NoFactoryAvailableException;
 import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.spi.DataFormatResolver;
 import org.apache.camel.spi.FactoryFinder;
 import org.apache.camel.util.ResolverHelper;
@@ -29,38 +30,65 @@ import org.apache.camel.util.ResolverHelper;
  * @version
  */
 public class DefaultDataFormatResolver implements DataFormatResolver {
-
     public static final String DATAFORMAT_RESOURCE_PATH = "META-INF/services/org/apache/camel/dataformat/";
 
-    protected FactoryFinder dataformatFactory;
+    private FactoryFinder dataformatFactory;
 
+    @Override
     public DataFormat resolveDataFormat(String name, CamelContext context) {
         // lookup in registry first
         DataFormat dataFormat = ResolverHelper.lookupDataFormatInRegistryWithFallback(context, name);
 
         if (dataFormat == null) {
-            Class<?> type = null;
-            try {
-                if (dataformatFactory == null) {
-                    dataformatFactory = context.getFactoryFinder(DATAFORMAT_RESOURCE_PATH);
-                }
-                type = dataformatFactory.findClass(name);
-            } catch (NoFactoryAvailableException e) {
-                // ignore
-            } catch (Exception e) {
-                throw new IllegalArgumentException("Invalid URI, no DataFormat registered for scheme: " + name, e);
-            }
+            // If not found in the registry, try to create a new instance using
+            // a DataFormatFactory or from resources
+            dataFormat = createDataFormat(name, context);
+        }
+
+        return dataFormat;
+    }
+
+    @Override
+    public DataFormat createDataFormat(String name, CamelContext context) {
+        DataFormat dataFormat = null;
+
+        // lookup in registry first
+        DataFormatFactory dataFormatFactory = ResolverHelper.lookupDataFormatFactoryInRegistryWithFallback(context, name);
+        if (dataFormatFactory != null) {
+            dataFormat = dataFormatFactory.newInstance();
+        }
 
-            if (type == null) {
-                type = context.getClassResolver().resolveClass(name);
+        if (dataFormat == null) {
+            dataFormat = createDataFormatFromResource(name, context);
+        }
+
+        return dataFormat;
+    }
+
+    private DataFormat createDataFormatFromResource(String name, CamelContext context) {
+        DataFormat dataFormat = null;
+
+        Class<?> type = null;
+        try {
+            if (dataformatFactory == null) {
+                dataformatFactory = context.getFactoryFinder(DATAFORMAT_RESOURCE_PATH);
             }
+            type = dataformatFactory.findClass(name);
+        } catch (NoFactoryAvailableException e) {
+            // ignore
+        } catch (Exception e) {
+            throw new IllegalArgumentException("Invalid URI, no DataFormat registered for scheme: " + name, e);
+        }
+
+        if (type == null) {
+            type = context.getClassResolver().resolveClass(name);
+        }
 
-            if (type != null) {
-                if (DataFormat.class.isAssignableFrom(type)) {
-                    dataFormat = (DataFormat) context.getInjector().newInstance(type);
-                } else {
-                    throw new IllegalArgumentException("Resolving dataformat: " + name + " detected type conflict: Not a DataFormat implementation. Found: " + type.getName());
-                }
+        if (type != null) {
+            if (DataFormat.class.isAssignableFrom(type)) {
+                dataFormat = (DataFormat) context.getInjector().newInstance(type);
+            } else {
+                throw new IllegalArgumentException("Resolving dataformat: " + name + " detected type conflict: Not a DataFormat implementation. Found: " + type.getName());
             }
         }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java b/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
index 5eb3ced..917d83a 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/osgi/Activator.java
@@ -345,7 +345,18 @@ public class Activator implements BundleActivator, BundleTrackerCustomizer {
             this.dataformats = dataformats;
         }
 
+        @Override
         public DataFormat resolveDataFormat(String name, CamelContext context) {
+            DataFormat dataFormat = createInstance(name, dataformats.get(name), context);
+            if (dataFormat == null) {
+                dataFormat = createDataFormat(name, context);
+            }
+
+            return dataFormat;
+        }
+
+        @Override
+        public DataFormat createDataFormat(String name, CamelContext context) {
             return createInstance(name, dataformats.get(name), context);
         }
 
@@ -353,6 +364,7 @@ public class Activator implements BundleActivator, BundleTrackerCustomizer {
             return null;
         }
 
+        @Override
         public void register() {
             doRegister(DataFormatResolver.class, "dataformat", dataformats.keySet());
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/camel-core/src/main/java/org/apache/camel/model/DataFormatDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/DataFormatDefinition.java b/camel-core/src/main/java/org/apache/camel/model/DataFormatDefinition.java
index 06eeb19..d07b454 100644
--- a/camel-core/src/main/java/org/apache/camel/model/DataFormatDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/DataFormatDefinition.java
@@ -133,7 +133,7 @@ public class DataFormatDefinition extends IdentifiedType implements OtherAttribu
     protected DataFormat createDataFormat(RouteContext routeContext) {
         // must use getDataFormatName() as we need special logic in json dataformat
         if (getDataFormatName() != null) {
-            return routeContext.getCamelContext().resolveDataFormat(getDataFormatName());
+            return routeContext.getCamelContext().createDataFormat(getDataFormatName());
         }
         return null;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/camel-core/src/main/java/org/apache/camel/spi/DataFormatFactory.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/spi/DataFormatFactory.java b/camel-core/src/main/java/org/apache/camel/spi/DataFormatFactory.java
new file mode 100644
index 0000000..557cfad
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/spi/DataFormatFactory.java
@@ -0,0 +1,31 @@
+/**
+ * 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.spi;
+
+/**
+ * A factory to create {@link org.apache.camel.spi.DataFormat}.
+ */
+@FunctionalInterface
+public interface DataFormatFactory {
+    /**
+     * Creates a new DataFormat instance.
+     *
+     * @return the instance
+     */
+    DataFormat newInstance();
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/camel-core/src/main/java/org/apache/camel/spi/DataFormatResolver.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/spi/DataFormatResolver.java b/camel-core/src/main/java/org/apache/camel/spi/DataFormatResolver.java
index b3de2cc..2f846aa 100644
--- a/camel-core/src/main/java/org/apache/camel/spi/DataFormatResolver.java
+++ b/camel-core/src/main/java/org/apache/camel/spi/DataFormatResolver.java
@@ -24,7 +24,6 @@ import org.apache.camel.CamelContext;
  * @version 
  */
 public interface DataFormatResolver {
-
     /**
      * Resolves the given data format given its name.
      *
@@ -34,4 +33,12 @@ public interface DataFormatResolver {
      */
     DataFormat resolveDataFormat(String name, CamelContext context);
 
+    /**
+     * Creates the given data format given its name.
+     *
+     * @param name the name of the data format factory to lookup in {@link org.apache.camel.spi.Registry} or create
+     * @param context the camel context
+     * @return the data format or <tt>null</tt> if not possible to resolve
+     */
+    DataFormat createDataFormat(String name, CamelContext context);
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/camel-core/src/main/java/org/apache/camel/util/ResolverHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/ResolverHelper.java b/camel-core/src/main/java/org/apache/camel/util/ResolverHelper.java
index a972c4d..a551d73 100644
--- a/camel-core/src/main/java/org/apache/camel/util/ResolverHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/ResolverHelper.java
@@ -19,6 +19,7 @@ package org.apache.camel.util;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Component;
 import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.spi.Language;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -34,6 +35,8 @@ public final class ResolverHelper {
 
     public static final String DATA_FORMAT_FALLBACK_SUFFIX = "-dataformat";
 
+    public static final String DATA_FORMAT_FACTORY_FALLBACK_SUFFIX = "-dataformat-factory";
+
     public static final String LANGUAGE_FALLBACK_SUFFIX = "-language";
 
     private static final Logger LOG = LoggerFactory.getLogger(ResolverHelper.class);
@@ -87,6 +90,22 @@ public final class ResolverHelper {
         return null;
     }
 
+    public static DataFormatFactory lookupDataFormatFactoryInRegistryWithFallback(CamelContext context, String name) {
+        return lookupDataFormatFactoryInRegistryWithFallback(context, name, EXCEPTION_HANDLER);
+    }
+
+    public static DataFormatFactory lookupDataFormatFactoryInRegistryWithFallback(CamelContext context, String name, LookupExceptionHandler exceptionHandler) {
+        Object bean = lookupInRegistry(context, DataFormatFactory.class, false, exceptionHandler, name, name + DATA_FORMAT_FACTORY_FALLBACK_SUFFIX);
+        if (bean instanceof DataFormatFactory) {
+            return (DataFormatFactory) bean;
+        }
+
+        if (bean != null) {
+            LOG.debug("Found DataFormatFactory with incompatible class: {}", bean.getClass().getName());
+        }
+        return null;
+    }
+
     public static Language lookupLanguageInRegistryWithFallback(CamelContext context, String name) {
         return lookupLanguageInRegistryWithFallback(context, name, EXCEPTION_HANDLER);
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/camel-core/src/test/java/org/apache/camel/processor/DataFormatFactoryTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/DataFormatFactoryTest.java b/camel-core/src/test/java/org/apache/camel/processor/DataFormatFactoryTest.java
new file mode 100644
index 0000000..802bbc2
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/processor/DataFormatFactoryTest.java
@@ -0,0 +1,53 @@
+/**
+ * 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.processor;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.impl.SerializationDataFormat;
+import org.apache.camel.impl.StringDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
+
+public class DataFormatFactoryTest extends ContextTestSupport {
+    private static final DataFormat STRING_DF = new StringDataFormat("US-ASCII");
+    private static final DataFormatFactory STRING_DFF = () -> new StringDataFormat("UTF-8");
+    private static final DataFormat SERIALIZATION_DF = new SerializationDataFormat();
+
+    public void testDataFormatResolveOrCreate() throws Exception {
+        assertSame(STRING_DF, context.resolveDataFormat("string"));
+        assertNotSame(STRING_DF, context.createDataFormat("string"));
+        assertNotSame(context.createDataFormat("string"), context.createDataFormat("string"));
+        
+        assertSame(SERIALIZATION_DF, context.resolveDataFormat("serialization"));
+        assertNotSame(SERIALIZATION_DF, context.createDataFormat("serialization"));
+        assertNotSame(context.createDataFormat("serialization"), context.createDataFormat("serialization"));
+
+        assertEquals("US-ASCII", ((StringDataFormat)context.resolveDataFormat("string")).getCharset());
+        assertEquals("UTF-8", ((StringDataFormat)context.createDataFormat("string")).getCharset());
+    }
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry registry = super.createRegistry();
+        registry.bind("string-dataformat", STRING_DF);
+        registry.bind("string-dataformat-factory", STRING_DFF);
+        registry.bind("serialization", SERIALIZATION_DF);
+
+        return registry;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintDataFormatResolver.java
----------------------------------------------------------------------
diff --git a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintDataFormatResolver.java b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintDataFormatResolver.java
index 1673c0e..7bec9b2 100644
--- a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintDataFormatResolver.java
+++ b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintDataFormatResolver.java
@@ -19,13 +19,13 @@ package org.apache.camel.blueprint;
 import org.apache.camel.CamelContext;
 import org.apache.camel.core.osgi.OsgiDataFormatResolver;
 import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.spi.DataFormatResolver;
 import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class BlueprintDataFormatResolver extends OsgiDataFormatResolver {
-
     private static final Logger LOG = LoggerFactory.getLogger(BlueprintDataFormatResolver.class);
 
     public BlueprintDataFormatResolver(BundleContext bundleContext) {
@@ -34,16 +34,29 @@ public class BlueprintDataFormatResolver extends OsgiDataFormatResolver {
 
     @Override
     public DataFormat resolveDataFormat(String name, CamelContext context) {
-        try {
-            Object bean = context.getRegistry().lookupByName(".camelBlueprint.dataformatResolver." + name);
-            if (bean instanceof DataFormatResolver) {
-                LOG.debug("Found dataformat resolver: {} in registry: {}", name, bean);
-                return ((DataFormatResolver) bean).resolveDataFormat(name, context);
-            }
-        } catch (Exception e) {
-            LOG.trace("Ignored error looking up bean: " + name + " due: " + e.getMessage(), e);
+        DataFormat dataFormat = null;
+
+        DataFormatResolver resolver = context.getRegistry().lookupByNameAndType(".camelBlueprint.dataformatResolver." + name, DataFormatResolver.class);
+        if (resolver != null) {
+            LOG.debug("Found dataformat resolver: {} in registry: {}", name, resolver);
+            dataFormat = resolver.resolveDataFormat(name, context);
         }
-        return super.resolveDataFormat(name, context);
+
+        if (dataFormat == null) {
+            dataFormat = super.resolveDataFormat(name, context);
+        }
+
+        return dataFormat;
     }
 
+    @Override
+    public DataFormat createDataFormat(String name, CamelContext context) {
+        DataFormatFactory factory = context.getRegistry().lookupByNameAndType(".camelBlueprint.dataformatFactory." + name, DataFormatFactory.class);
+        if (factory  != null) {
+            LOG.debug("Found dataformat factory: {} in registry: {}", name, factory);
+            return factory.newInstance();
+        }
+
+        return super.createDataFormat(name, context);
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDataFormatResolver.java
----------------------------------------------------------------------
diff --git a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDataFormatResolver.java b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDataFormatResolver.java
index c403632..af70de7 100644
--- a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDataFormatResolver.java
+++ b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDataFormatResolver.java
@@ -16,8 +16,11 @@
  */
 package org.apache.camel.core.osgi;
 
+import java.util.Collection;
+
 import org.apache.camel.CamelContext;
 import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.spi.DataFormatResolver;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.ResolverHelper;
@@ -38,25 +41,43 @@ public class OsgiDataFormatResolver implements DataFormatResolver {
 
     public DataFormat resolveDataFormat(String name, CamelContext context) {
         // lookup in registry first
-        DataFormat dataFormatReg = ResolverHelper.lookupDataFormatInRegistryWithFallback(context, name);
-        if (dataFormatReg != null) {
-            return dataFormatReg;
+        DataFormat dataFormat = ResolverHelper.lookupDataFormatInRegistryWithFallback(context, name);
+        if (dataFormat == null) {
+            dataFormat = getDataFormat(name, context, false);
+        }
+
+        if (dataFormat == null) {
+            dataFormat = createDataFormat(name, context);
+        }
+
+        return dataFormat;
+    }
+
+    public DataFormat createDataFormat(String name, CamelContext context) {
+        DataFormat dataFormat = null;
+
+        // lookup in registry first
+        DataFormatFactory dataFormatFactory = ResolverHelper.lookupDataFormatFactoryInRegistryWithFallback(context, name);
+        if (dataFormatFactory != null) {
+            dataFormat = dataFormatFactory.newInstance();
+        }
+
+        if (dataFormat == null) {
+            dataFormat = getDataFormat(name, context, true);
         }
 
-        return getDataFormat(name, context);
+        return dataFormat;
     }
 
-    protected DataFormat getDataFormat(String name, CamelContext context) {
+    private DataFormat getDataFormat(String name, CamelContext context, boolean create) {
         LOG.trace("Finding DataFormat: {}", name);
         try {
-            ServiceReference<?>[] refs = bundleContext.getServiceReferences(DataFormatResolver.class.getName(), "(dataformat=" + name + ")");
+            Collection<ServiceReference<DataFormatResolver>> refs = bundleContext.getServiceReferences(DataFormatResolver.class, "(dataformat=" + name + ")");
             if (refs != null) {
-                for (ServiceReference<?> ref : refs) {
-                    Object service = bundleContext.getService(ref);
-                    if (DataFormatResolver.class.isAssignableFrom(service.getClass())) {
-                        DataFormatResolver resolver = (DataFormatResolver) service;
-                        return resolver.resolveDataFormat(name, context);
-                    }
+                for (ServiceReference<DataFormatResolver> ref : refs) {
+                    return create
+                        ? bundleContext.getService(ref).createDataFormat(name, context)
+                        : bundleContext.getService(ref).resolveDataFormat(name, context);
                 }
             }
             return null;

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvDataFormatCustomFactoryTest.java
----------------------------------------------------------------------
diff --git a/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvDataFormatCustomFactoryTest.java b/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvDataFormatCustomFactoryTest.java
new file mode 100644
index 0000000..7950545
--- /dev/null
+++ b/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvDataFormatCustomFactoryTest.java
@@ -0,0 +1,58 @@
+/**
+ * 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.dataformat.csv;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class CsvDataFormatCustomFactoryTest extends CamelSpringTestSupport {
+    @Test
+    public void marshalTest() throws InterruptedException {
+        MockEndpoint mock = getMockEndpoint("mock:marshaled");
+        mock.expectedMessageCount(1);
+
+        template.sendBody("direct:marshal", getData());
+
+        mock.assertIsSatisfied();
+
+        String body = mock.getReceivedExchanges().get(0).getIn().getBody(String.class);
+        String[] lines = body.split("\r\n");
+
+        Assert.assertEquals(2, lines.length);
+        Assert.assertEquals("A1:B1:C1", lines[0].trim());
+        Assert.assertEquals("A2:B2:C2", lines[1].trim());
+    }
+
+    private List<List<String>> getData() {
+        return Arrays.asList(
+            Arrays.asList("A1", "B1", "C1"),
+            Arrays.asList("A2", "B2", "C2")
+        );
+    }
+
+    @Override
+    protected ClassPathXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/dataformat/csv/CsvDataFormatCustomFactoryTest-context.xml");
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvDataFormatResourceFactoryTest.java
----------------------------------------------------------------------
diff --git a/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvDataFormatResourceFactoryTest.java b/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvDataFormatResourceFactoryTest.java
new file mode 100644
index 0000000..5714808
--- /dev/null
+++ b/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvDataFormatResourceFactoryTest.java
@@ -0,0 +1,57 @@
+/**
+ * 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.dataformat.csv;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class CsvDataFormatResourceFactoryTest extends CamelSpringTestSupport {
+    @Test
+    public void marshalTest() throws InterruptedException {
+        MockEndpoint mock = getMockEndpoint("mock:marshaled");
+        mock.expectedMessageCount(1);
+
+        template.sendBody("direct:marshal", getData());
+
+        mock.assertIsSatisfied();
+
+        String body = mock.getReceivedExchanges().get(0).getIn().getBody(String.class);
+        String[] lines = body.split("\r\n");
+
+        Assert.assertEquals(2, lines.length);
+        Assert.assertEquals("A1,B1,C1", lines[0].trim());
+        Assert.assertEquals("A2,B2,C2", lines[1].trim());
+    }
+
+    private List<List<String>> getData() {
+        return Arrays.asList(
+            Arrays.asList("A1", "B1", "C1"),
+            Arrays.asList("A2", "B2", "C2")
+        );
+    }
+
+    @Override
+    protected ClassPathXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/dataformat/csv/CsvDataFormatResourceFactoryTest-context.xml");
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/MyCsvDataFormatFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/MyCsvDataFormatFactory.java b/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/MyCsvDataFormatFactory.java
new file mode 100644
index 0000000..28c7065
--- /dev/null
+++ b/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/MyCsvDataFormatFactory.java
@@ -0,0 +1,37 @@
+/**
+ * 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.dataformat.csv;
+
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
+
+public class MyCsvDataFormatFactory implements DataFormatFactory {
+    private final char delimiter;
+
+    public MyCsvDataFormatFactory(char delimiter) {
+        this.delimiter = delimiter;
+    }
+
+    @Override
+    public DataFormat newInstance() {
+        CsvDataFormat dataFormat = new CsvDataFormat();
+        dataFormat.setDelimiter(delimiter);
+
+        return dataFormat;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/components/camel-csv/src/test/resources/org/apache/camel/dataformat/csv/CsvDataFormatCustomFactoryTest-context.xml
----------------------------------------------------------------------
diff --git a/components/camel-csv/src/test/resources/org/apache/camel/dataformat/csv/CsvDataFormatCustomFactoryTest-context.xml b/components/camel-csv/src/test/resources/org/apache/camel/dataformat/csv/CsvDataFormatCustomFactoryTest-context.xml
new file mode 100644
index 0000000..3668a73
--- /dev/null
+++ b/components/camel-csv/src/test/resources/org/apache/camel/dataformat/csv/CsvDataFormatCustomFactoryTest-context.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+    http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+  <bean id="csv-dataformat-factory" class="org.apache.camel.dataformat.csv.MyCsvDataFormatFactory">
+    <constructor-arg value=":"/>
+  </bean>
+
+  <camelContext id="csvCamelContext" xmlns="http://camel.apache.org/schema/spring">
+    <route>
+      <from uri="direct:marshal"/>
+      <marshal>
+        <csv headerDisabled="true" quoteDisabled="true"/>
+      </marshal>
+      <convertBodyTo type="java.lang.String"/>
+      <to uri="mock:marshaled"/>
+    </route>
+    <route>
+      <from uri="direct:unmarshal"/>
+      <unmarshal>
+        <csv delimiter=";" headerDisabled="true"/>
+      </unmarshal>
+      <to uri="mock:unmarshaled"/>
+    </route>
+  </camelContext>
+
+</beans>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/components/camel-csv/src/test/resources/org/apache/camel/dataformat/csv/CsvDataFormatResourceFactoryTest-context.xml
----------------------------------------------------------------------
diff --git a/components/camel-csv/src/test/resources/org/apache/camel/dataformat/csv/CsvDataFormatResourceFactoryTest-context.xml b/components/camel-csv/src/test/resources/org/apache/camel/dataformat/csv/CsvDataFormatResourceFactoryTest-context.xml
new file mode 100644
index 0000000..f6b60f2
--- /dev/null
+++ b/components/camel-csv/src/test/resources/org/apache/camel/dataformat/csv/CsvDataFormatResourceFactoryTest-context.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+    http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+  <bean id="csv-dataformat" class="org.apache.camel.dataformat.csv.CsvDataFormat"/>
+
+  <camelContext id="csvCamelContext" xmlns="http://camel.apache.org/schema/spring">
+    <route>
+      <from uri="direct:marshal"/>
+      <marshal>
+        <csv headerDisabled="true" quoteDisabled="true"/>
+      </marshal>
+      <convertBodyTo type="java.lang.String"/>
+      <to uri="mock:marshaled"/>
+    </route>
+    <route>
+      <from uri="direct:unmarshal"/>
+      <unmarshal>
+        <csv delimiter=";" headerDisabled="true"/>
+      </unmarshal>
+      <to uri="mock:unmarshaled"/>
+    </route>
+  </camelContext>
+
+</beans>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-avro-starter/src/main/java/org/apache/camel/dataformat/avro/springboot/AvroDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-avro-starter/src/main/java/org/apache/camel/dataformat/avro/springboot/AvroDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-avro-starter/src/main/java/org/apache/camel/dataformat/avro/springboot/AvroDataFormatAutoConfiguration.java
index dee5a8f..f4e6093 100644
--- a/platforms/spring-boot/components-starter/camel-avro-starter/src/main/java/org/apache/camel/dataformat/avro/springboot/AvroDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-avro-starter/src/main/java/org/apache/camel/dataformat/avro/springboot/AvroDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.avro.AvroDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,26 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(AvroDataFormatConfiguration.class)
 public class AvroDataFormatAutoConfiguration {
 
-    @Bean(name = "avro-dataformat")
-    @Scope("prototype")
+    @Bean(name = "avro-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(AvroDataFormat.class)
-    public AvroDataFormat configureAvroDataFormat(CamelContext camelContext,
-            AvroDataFormatConfiguration configuration) throws Exception {
-        AvroDataFormat dataformat = new AvroDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(AvroDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureAvroDataFormatFactory(
+            final CamelContext camelContext,
+            final AvroDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                AvroDataFormat dataformat = new AvroDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(AvroDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-barcode-starter/src/main/java/org/apache/camel/dataformat/barcode/springboot/BarcodeDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-barcode-starter/src/main/java/org/apache/camel/dataformat/barcode/springboot/BarcodeDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-barcode-starter/src/main/java/org/apache/camel/dataformat/barcode/springboot/BarcodeDataFormatAutoConfiguration.java
index cf84be8..ce76822 100644
--- a/platforms/spring-boot/components-starter/camel-barcode-starter/src/main/java/org/apache/camel/dataformat/barcode/springboot/BarcodeDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-barcode-starter/src/main/java/org/apache/camel/dataformat/barcode/springboot/BarcodeDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.barcode.BarcodeDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,27 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(BarcodeDataFormatConfiguration.class)
 public class BarcodeDataFormatAutoConfiguration {
 
-    @Bean(name = "barcode-dataformat")
-    @Scope("prototype")
+    @Bean(name = "barcode-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(BarcodeDataFormat.class)
-    public BarcodeDataFormat configureBarcodeDataFormat(
-            CamelContext camelContext,
-            BarcodeDataFormatConfiguration configuration) throws Exception {
-        BarcodeDataFormat dataformat = new BarcodeDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(BarcodeDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureBarcodeDataFormatFactory(
+            final CamelContext camelContext,
+            final BarcodeDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                BarcodeDataFormat dataformat = new BarcodeDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(BarcodeDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-base64-starter/src/main/java/org/apache/camel/dataformat/base64/springboot/Base64DataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-base64-starter/src/main/java/org/apache/camel/dataformat/base64/springboot/Base64DataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-base64-starter/src/main/java/org/apache/camel/dataformat/base64/springboot/Base64DataFormatAutoConfiguration.java
index a84ad11..11b6c7a 100644
--- a/platforms/spring-boot/components-starter/camel-base64-starter/src/main/java/org/apache/camel/dataformat/base64/springboot/Base64DataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-base64-starter/src/main/java/org/apache/camel/dataformat/base64/springboot/Base64DataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.base64.Base64DataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,27 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(Base64DataFormatConfiguration.class)
 public class Base64DataFormatAutoConfiguration {
 
-    @Bean(name = "base64-dataformat")
-    @Scope("prototype")
+    @Bean(name = "base64-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(Base64DataFormat.class)
-    public Base64DataFormat configureBase64DataFormat(
-            CamelContext camelContext,
-            Base64DataFormatConfiguration configuration) throws Exception {
-        Base64DataFormat dataformat = new Base64DataFormat();
-        if (CamelContextAware.class.isAssignableFrom(Base64DataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureBase64DataFormatFactory(
+            final CamelContext camelContext,
+            final Base64DataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                Base64DataFormat dataformat = new Base64DataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(Base64DataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-beanio-starter/src/main/java/org/apache/camel/dataformat/beanio/springboot/BeanIODataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-beanio-starter/src/main/java/org/apache/camel/dataformat/beanio/springboot/BeanIODataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-beanio-starter/src/main/java/org/apache/camel/dataformat/beanio/springboot/BeanIODataFormatAutoConfiguration.java
index f207b6f..dc93bab 100644
--- a/platforms/spring-boot/components-starter/camel-beanio-starter/src/main/java/org/apache/camel/dataformat/beanio/springboot/BeanIODataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-beanio-starter/src/main/java/org/apache/camel/dataformat/beanio/springboot/BeanIODataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.beanio.BeanIODataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,27 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(BeanIODataFormatConfiguration.class)
 public class BeanIODataFormatAutoConfiguration {
 
-    @Bean(name = "beanio-dataformat")
-    @Scope("prototype")
+    @Bean(name = "beanio-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(BeanIODataFormat.class)
-    public BeanIODataFormat configureBeanIODataFormat(
-            CamelContext camelContext,
-            BeanIODataFormatConfiguration configuration) throws Exception {
-        BeanIODataFormat dataformat = new BeanIODataFormat();
-        if (CamelContextAware.class.isAssignableFrom(BeanIODataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureBeanIODataFormatFactory(
+            final CamelContext camelContext,
+            final BeanIODataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                BeanIODataFormat dataformat = new BeanIODataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(BeanIODataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/csv/springboot/BindyCsvDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/csv/springboot/BindyCsvDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/csv/springboot/BindyCsvDataFormatAutoConfiguration.java
index 9309645..e2583ee 100644
--- a/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/csv/springboot/BindyCsvDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/csv/springboot/BindyCsvDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.bindy.csv.BindyCsvDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,27 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(BindyCsvDataFormatConfiguration.class)
 public class BindyCsvDataFormatAutoConfiguration {
 
-    @Bean(name = "bindy-csv-dataformat")
-    @Scope("prototype")
+    @Bean(name = "bindy-csv-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(BindyCsvDataFormat.class)
-    public BindyCsvDataFormat configureBindyCsvDataFormat(
-            CamelContext camelContext,
-            BindyCsvDataFormatConfiguration configuration) throws Exception {
-        BindyCsvDataFormat dataformat = new BindyCsvDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(BindyCsvDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureBindyCsvDataFormatFactory(
+            final CamelContext camelContext,
+            final BindyCsvDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                BindyCsvDataFormat dataformat = new BindyCsvDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(BindyCsvDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/fixed/springboot/BindyFixedLengthDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/fixed/springboot/BindyFixedLengthDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/fixed/springboot/BindyFixedLengthDataFormatAutoConfiguration.java
index b19ac42..64a547a 100644
--- a/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/fixed/springboot/BindyFixedLengthDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/fixed/springboot/BindyFixedLengthDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,29 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(BindyFixedLengthDataFormatConfiguration.class)
 public class BindyFixedLengthDataFormatAutoConfiguration {
 
-    @Bean(name = "bindy-fixed-dataformat")
-    @Scope("prototype")
+    @Bean(name = "bindy-fixed-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(BindyFixedLengthDataFormat.class)
-    public BindyFixedLengthDataFormat configureBindyFixedLengthDataFormat(
-            CamelContext camelContext,
-            BindyFixedLengthDataFormatConfiguration configuration)
-            throws Exception {
-        BindyFixedLengthDataFormat dataformat = new BindyFixedLengthDataFormat();
-        if (CamelContextAware.class
-                .isAssignableFrom(BindyFixedLengthDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureBindyFixedLengthDataFormatFactory(
+            final CamelContext camelContext,
+            final BindyFixedLengthDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                BindyFixedLengthDataFormat dataformat = new BindyFixedLengthDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(BindyFixedLengthDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/kvp/springboot/BindyKeyValuePairDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/kvp/springboot/BindyKeyValuePairDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/kvp/springboot/BindyKeyValuePairDataFormatAutoConfiguration.java
index 27b0cbd..733e14c 100644
--- a/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/kvp/springboot/BindyKeyValuePairDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/kvp/springboot/BindyKeyValuePairDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.bindy.kvp.BindyKeyValuePairDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,29 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(BindyKeyValuePairDataFormatConfiguration.class)
 public class BindyKeyValuePairDataFormatAutoConfiguration {
 
-    @Bean(name = "bindy-kvp-dataformat")
-    @Scope("prototype")
+    @Bean(name = "bindy-kvp-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(BindyKeyValuePairDataFormat.class)
-    public BindyKeyValuePairDataFormat configureBindyKeyValuePairDataFormat(
-            CamelContext camelContext,
-            BindyKeyValuePairDataFormatConfiguration configuration)
-            throws Exception {
-        BindyKeyValuePairDataFormat dataformat = new BindyKeyValuePairDataFormat();
-        if (CamelContextAware.class
-                .isAssignableFrom(BindyKeyValuePairDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureBindyKeyValuePairDataFormatFactory(
+            final CamelContext camelContext,
+            final BindyKeyValuePairDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                BindyKeyValuePairDataFormat dataformat = new BindyKeyValuePairDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(BindyKeyValuePairDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-boon-starter/src/main/java/org/apache/camel/component/boon/springboot/BoonDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-boon-starter/src/main/java/org/apache/camel/component/boon/springboot/BoonDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-boon-starter/src/main/java/org/apache/camel/component/boon/springboot/BoonDataFormatAutoConfiguration.java
index ff20711..5d6702f 100644
--- a/platforms/spring-boot/components-starter/camel-boon-starter/src/main/java/org/apache/camel/component/boon/springboot/BoonDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-boon-starter/src/main/java/org/apache/camel/component/boon/springboot/BoonDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.component.boon.BoonDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,26 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(BoonDataFormatConfiguration.class)
 public class BoonDataFormatAutoConfiguration {
 
-    @Bean(name = "boon-dataformat")
-    @Scope("prototype")
+    @Bean(name = "boon-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(BoonDataFormat.class)
-    public BoonDataFormat configureBoonDataFormat(CamelContext camelContext,
-            BoonDataFormatConfiguration configuration) throws Exception {
-        BoonDataFormat dataformat = new BoonDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(BoonDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureBoonDataFormatFactory(
+            final CamelContext camelContext,
+            final BoonDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                BoonDataFormat dataformat = new BoonDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(BoonDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {

http://git-wip-us.apache.org/repos/asf/camel/blob/c0a9f5cd/platforms/spring-boot/components-starter/camel-castor-starter/src/main/java/org/apache/camel/dataformat/castor/springboot/CastorDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-castor-starter/src/main/java/org/apache/camel/dataformat/castor/springboot/CastorDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-castor-starter/src/main/java/org/apache/camel/dataformat/castor/springboot/CastorDataFormatAutoConfiguration.java
index 07ec505..f4588e1 100644
--- a/platforms/spring-boot/components-starter/camel-castor-starter/src/main/java/org/apache/camel/dataformat/castor/springboot/CastorDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-castor-starter/src/main/java/org/apache/camel/dataformat/castor/springboot/CastorDataFormatAutoConfiguration.java
@@ -20,7 +20,10 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.dataformat.castor.CastorDataFormat;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatFactory;
 import org.apache.camel.util.IntrospectionSupport;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionMessage;
@@ -35,7 +38,6 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ConditionContext;
 import org.springframework.context.annotation.Conditional;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Scope;
 import org.springframework.core.type.AnnotatedTypeMetadata;
 
 /**
@@ -48,27 +50,36 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
 @EnableConfigurationProperties(CastorDataFormatConfiguration.class)
 public class CastorDataFormatAutoConfiguration {
 
-    @Bean(name = "castor-dataformat")
-    @Scope("prototype")
+    @Bean(name = "castor-dataformat-factory")
     @ConditionalOnClass(CamelContext.class)
     @ConditionalOnMissingBean(CastorDataFormat.class)
-    public CastorDataFormat configureCastorDataFormat(
-            CamelContext camelContext,
-            CastorDataFormatConfiguration configuration) throws Exception {
-        CastorDataFormat dataformat = new CastorDataFormat();
-        if (CamelContextAware.class.isAssignableFrom(CastorDataFormat.class)) {
-            CamelContextAware contextAware = CamelContextAware.class
-                    .cast(dataformat);
-            if (contextAware != null) {
-                contextAware.setCamelContext(camelContext);
+    public DataFormatFactory configureCastorDataFormatFactory(
+            final CamelContext camelContext,
+            final CastorDataFormatConfiguration configuration) {
+        return new DataFormatFactory() {
+            public DataFormat newInstance() {
+                CastorDataFormat dataformat = new CastorDataFormat();
+                if (CamelContextAware.class
+                        .isAssignableFrom(CastorDataFormat.class)) {
+                    CamelContextAware contextAware = CamelContextAware.class
+                            .cast(dataformat);
+                    if (contextAware != null) {
+                        contextAware.setCamelContext(camelContext);
+                    }
+                }
+                try {
+                    Map<String, Object> parameters = new HashMap<>();
+                    IntrospectionSupport.getProperties(configuration,
+                            parameters, null, false);
+                    IntrospectionSupport.setProperties(camelContext,
+                            camelContext.getTypeConverter(), dataformat,
+                            parameters);
+                } catch (Exception e) {
+                    throw new RuntimeCamelException(e);
+                }
+                return dataformat;
             }
-        }
-        Map<String, Object> parameters = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, parameters, null,
-                false);
-        IntrospectionSupport.setProperties(camelContext,
-                camelContext.getTypeConverter(), dataformat, parameters);
-        return dataformat;
+        };
     }
 
     public static class Condition extends SpringBootCondition {