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 2015/12/16 09:29:52 UTC

[5/5] camel git commit: camel-spring-boot should skip adding abstract route classes and the FarJarRouter

camel-spring-boot should skip adding abstract route classes and the FarJarRouter


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

Branch: refs/heads/camel-2.15.x
Commit: 6276e2e5ad93cd3ee9de9d52fdb4df38247c0a8a
Parents: 02ce9b1
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Dec 16 09:07:27 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Dec 16 09:29:16 2015 +0100

----------------------------------------------------------------------
 .../apache/camel/spring/boot/RoutesCollector.java  | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6276e2e5/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java
index 1a4ffda..d034a3e 100644
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java
@@ -17,6 +17,7 @@
 package org.apache.camel.spring.boot;
 
 import java.io.FileNotFoundException;
+import java.lang.reflect.Modifier;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -62,11 +63,17 @@ public class RoutesCollector implements ApplicationListener<ContextRefreshedEven
             if (camelContext.getStatus().isStopped()) {
                 LOG.debug("Post-processing CamelContext bean: {}", camelContext.getName());
                 for (RoutesBuilder routesBuilder : applicationContext.getBeansOfType(RoutesBuilder.class).values()) {
-                    try {
-                        LOG.debug("Injecting following route into the CamelContext: {}", routesBuilder);
-                        camelContext.addRoutes(routesBuilder);
-                    } catch (Exception e) {
-                        throw new CamelSpringBootInitializationException(e);
+                    // filter out abstract classes
+                    boolean abs = Modifier.isAbstract(routesBuilder.getClass().getModifiers());
+                    // filter out FatJarRouter which can be in the spring app context
+                    boolean farJarRouter = FatJarRouter.class.equals(routesBuilder.getClass());
+                    if (!abs && !farJarRouter) {
+                        try {
+                            LOG.debug("Injecting following route into the CamelContext: {}", routesBuilder);
+                            camelContext.addRoutes(routesBuilder);
+                        } catch (Exception e) {
+                            throw new CamelSpringBootInitializationException(e);
+                        }
                     }
                 }