You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/03/28 14:37:08 UTC

[4/5] camel git commit: Camel Spring Javaconfig should also ioc producer/consumer template as spring-boot does.

Camel Spring Javaconfig should also ioc producer/consumer template as spring-boot does.


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

Branch: refs/heads/camel-2.17.x
Commit: e7ca81ba3f7a1f97f22a28ae3dfc9a4dcc792e82
Parents: bfbceb3
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Mar 28 14:35:48 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Mar 28 14:36:22 2016 +0200

----------------------------------------------------------------------
 .../spring/javaconfig/CamelConfiguration.java   | 21 ++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e7ca81ba/components/camel-spring-javaconfig/src/main/java/org/apache/camel/spring/javaconfig/CamelConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-javaconfig/src/main/java/org/apache/camel/spring/javaconfig/CamelConfiguration.java b/components/camel-spring-javaconfig/src/main/java/org/apache/camel/spring/javaconfig/CamelConfiguration.java
index d8aaf23..2df05da 100644
--- a/components/camel-spring-javaconfig/src/main/java/org/apache/camel/spring/javaconfig/CamelConfiguration.java
+++ b/components/camel-spring-javaconfig/src/main/java/org/apache/camel/spring/javaconfig/CamelConfiguration.java
@@ -19,9 +19,12 @@ package org.apache.camel.spring.javaconfig;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+
 import static java.util.Collections.emptyList;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.ConsumerTemplate;
+import org.apache.camel.ProducerTemplate;
 import org.apache.camel.RoutesBuilder;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.spring.CamelBeanPostProcessor;
@@ -123,6 +126,24 @@ public abstract class CamelConfiguration implements BeanFactoryAware, Applicatio
         return configuredObject;
     }
 
+    /**
+     * Get's the {@link ProducerTemplate} to be used.
+     */
+    @Bean(initMethod = "", destroyMethod = "")
+    // Camel handles the lifecycle of this bean
+    public ProducerTemplate producerTemplate(CamelContext camelContext) throws Exception {
+        return camelContext.createProducerTemplate();
+    }
+
+    /**
+     * Get's the {@link ConsumerTemplate} to be used.
+     */
+    @Bean(initMethod = "", destroyMethod = "")
+    // Camel handles the lifecycle of this bean
+    public ConsumerTemplate consumerTemplate(CamelContext camelContext) throws Exception {
+        return camelContext.createConsumerTemplate();
+    }
+
     @Bean
     public CamelBeanPostProcessor camelBeanPostProcessor() throws Exception {
         CamelBeanPostProcessor answer = new CamelBeanPostProcessor();