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 2019/02/27 16:40:58 UTC

[camel] branch master updated: CAMEL-13266: Fixed a mistake if JMX was disabled in Spring Boot

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

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new dd5414c  CAMEL-13266: Fixed a mistake if JMX was disabled in Spring Boot
dd5414c is described below

commit dd5414cb887c4a113b46de92cb6145361ec5917f
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Feb 27 17:40:36 2019 +0100

    CAMEL-13266: Fixed a mistake if JMX was disabled in Spring Boot
---
 components/camel-spring-boot/pom.xml                                 | 5 +++++
 .../java/org/apache/camel/impl/DefaultManagementStrategyFactory.java | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/components/camel-spring-boot/pom.xml b/components/camel-spring-boot/pom.xml
index 3d70295..8a7bd0b 100644
--- a/components/camel-spring-boot/pom.xml
+++ b/components/camel-spring-boot/pom.xml
@@ -68,6 +68,11 @@
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-spring</artifactId>
     </dependency>
+    <!-- JMX is enabled by default -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-management-impl</artifactId>
+    </dependency>
 
     <!-- Optional Spring web support -->
     <dependency>
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/DefaultManagementStrategyFactory.java b/core/camel-core/src/main/java/org/apache/camel/impl/DefaultManagementStrategyFactory.java
index 5d9d6d5..014db09 100644
--- a/core/camel-core/src/main/java/org/apache/camel/impl/DefaultManagementStrategyFactory.java
+++ b/core/camel-core/src/main/java/org/apache/camel/impl/DefaultManagementStrategyFactory.java
@@ -42,7 +42,9 @@ public class DefaultManagementStrategyFactory implements ManagementStrategyFacto
     @Override
     public void setupManagement(CamelContext camelContext, ManagementStrategy strategy, LifecycleStrategy lifecycle) {
         camelContext.setManagementStrategy(strategy);
-        // no need to add a lifecycle strategy as we do not need one as JMX is disabled
         camelContext.setManagementStrategy(new DefaultManagementStrategy());
+        // need to clear the lifecycle strategy as CamelContext will default enable JMX, and
+        // to turn this off we need no JMX lifecycle strategy to exists (at this time there is only this one)
+        camelContext.getLifecycleStrategies().clear();
     }
 }