You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ff...@apache.org on 2021/03/02 14:23:14 UTC

[camel] branch camel-3.7.x updated: [CAMEL-16063]don't start camel context if event is from the self management ApplicationContext

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

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


The following commit(s) were added to refs/heads/camel-3.7.x by this push:
     new 07d3f75  [CAMEL-16063]don't start camel context if event is from the self management ApplicationContext
     new 9e1b4e6  Merge branch 'camel-3.7.x' of github.com:apache/camel into camel-3.7.x
07d3f75 is described below

commit 07d3f754f54209d2b6103bbb21ffc818480dcc80
Author: Freeman Fang <fr...@gmail.com>
AuthorDate: Tue Mar 2 09:18:52 2021 -0500

    [CAMEL-16063]don't start camel context if event is from the self management ApplicationContext
    
    (cherry picked from commit 7ef2913089f6f5307ad2d75092f0e54421892928)
---
 .../java/org/apache/camel/spring/CamelContextFactoryBean.java     | 8 ++++++++
 1 file changed, 8 insertions(+)

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 a15737c..8aaa749 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
@@ -458,6 +458,14 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
         // being started/refreshed, there could be a race condition with
         // other ApplicationListeners that react to
         // ContextRefreshedEvent but this is the best that we can do
+        if (event.getSource() instanceof ApplicationContext) {
+            ApplicationContext appCtx = (ApplicationContext) event.getSource();
+            if (appCtx.getId().equals("application:management")) {
+                //don't start camel context if
+                //event is from the self management ApplicationContext
+                return;
+            }
+        }
         start();
     }