Repository: camel
Updated Branches:
  refs/heads/camel-2.15.x 02ce9b183 -> 6276e2e5a
  refs/heads/camel-2.16.x c471d7b41 -> fd7f890b3
  refs/heads/master 91c97237f -> 61aa28c97


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/b4373686
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b4373686
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b4373686

Branch: refs/heads/master
Commit: b4373686650c4851318b7e3f0d98fbd119e0cba4
Parents: 91c9723
Author: Claus Ibsen <davscl...@apache.org>
Authored: Wed Dec 16 09:07:27 2015 +0100
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Wed Dec 16 09:10:18 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/b4373686/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 af2f625..bf15018 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;
 
@@ -66,11 +67,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);
+                        }
                     }
                 }
 

Reply via email to