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

commit 420ca996cd5959c219e5290107338bac939c89ec
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Thu Apr 30 09:02:37 2020 +0200

    CAMEL-14969: Fix mixing Spring XML DSL with camel-spring-boot causes 
duplicate routes when using rest-dsl loaded from XML files.
---
 .../src/main/java/org/apache/camel/main/RoutesConfigurer.java  | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git 
a/core/camel-main/src/main/java/org/apache/camel/main/RoutesConfigurer.java 
b/core/camel-main/src/main/java/org/apache/camel/main/RoutesConfigurer.java
index fd60187..3a3d5a8 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/RoutesConfigurer.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/RoutesConfigurer.java
@@ -38,6 +38,7 @@ public class RoutesConfigurer {
 
     private final RoutesCollector routesCollector;
     private final List<RoutesBuilder> routesBuilders;
+    private boolean addRestsToRoutes = true;
 
     /**
      * Creates a new routes configurer
@@ -60,6 +61,13 @@ public class RoutesConfigurer {
     }
 
     /**
+     * Whether rests should be automatic added as routes
+     */
+    public void setAddRestsToRoutes(boolean addRestsToRoutes) {
+        this.addRestsToRoutes = addRestsToRoutes;
+    }
+
+    /**
      * Collects routes and rests from the various sources (like registry or 
opinionated
      * classpath locations) and injects (adds) these into the Camel context.
      *
@@ -98,7 +106,7 @@ public class RoutesConfigurer {
                     List<RestsDefinition> defs = 
routesCollector.collectXmlRestsFromDirectory(camelContext, 
config.getXmlRests());
                     for (RestsDefinition def : defs) {
                         LOG.debug("Adding rests into CamelContext from XML 
files: {}", config.getXmlRests());
-                        
camelContext.getExtension(Model.class).addRestDefinitions(def.getRests(), true);
+                        
camelContext.getExtension(Model.class).addRestDefinitions(def.getRests(), 
addRestsToRoutes);
                     }
                 }
             } catch (Exception e) {

Reply via email to