You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2018/01/10 13:19:51 UTC

[camel] branch camel-2.20.x updated: CAMEL-12134: avoid creating multiple contexts when using xml in spring-boot

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

nferraro pushed a commit to branch camel-2.20.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-2.20.x by this push:
     new a7b8063  CAMEL-12134: avoid creating multiple contexts when using xml in spring-boot
a7b8063 is described below

commit a7b806354bd55099a1dca6d629d4568d4a64a5a1
Author: Nicola Ferraro <ni...@gmail.com>
AuthorDate: Wed Jan 10 14:14:54 2018 +0100

    CAMEL-12134: avoid creating multiple contexts when using xml in spring-boot
---
 .../java/org/apache/camel/spring/CamelContextFactoryBean.java  | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
index 6f5b00a..b4d977c 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
@@ -449,6 +449,13 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
         SpringCamelContext ctx = newCamelContext();
         ctx.setName(getId());
 
+        return ctx;
+    }
+
+    /**
+     * Apply additional configuration to the context
+     */
+    protected void configure(SpringCamelContext ctx) {
         try {
             // allow any custom configuration, such as when running in camel-spring-boot
             if (applicationContext.containsBean("xmlCamelContextConfigurer")) {
@@ -461,8 +468,6 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
             // error during configuration
             throw ObjectHelper.wrapRuntimeCamelException(e);
         }
-
-        return ctx;
     }
 
     protected SpringCamelContext newCamelContext() {
@@ -472,6 +477,7 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
     public SpringCamelContext getContext(boolean create) {
         if (context == null && create) {
             context = createContext();
+            configure(context);
         }
         return context;
     }

-- 
To stop receiving notification emails like this one, please contact
['"commits@camel.apache.org" <co...@camel.apache.org>'].