Repository: camel Updated Branches: refs/heads/master 8098936f5 -> b225ec2ca
Spring Boot - XML routes detection is now optional. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b225ec2c Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b225ec2c Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b225ec2c Branch: refs/heads/master Commit: b225ec2ca9ac90a8cd69840ca33f7652404ce238 Parents: 8098936 Author: Henryk Konsek <hekon...@gmail.com> Authored: Mon Mar 23 15:03:25 2015 +0100 Committer: Henryk Konsek <hekon...@gmail.com> Committed: Mon Mar 23 15:03:43 2015 +0100 ---------------------------------------------------------------------- .../java/org/apache/camel/spring/boot/RoutesCollector.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/b225ec2c/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 72c4eda..c4809f9 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 @@ -16,6 +16,8 @@ */ package org.apache.camel.spring.boot; +import java.io.FileNotFoundException; +import java.util.ArrayList; import java.util.List; import org.apache.camel.CamelContext; @@ -30,6 +32,8 @@ import org.springframework.core.io.Resource; public class RoutesCollector implements ApplicationListener<ContextRefreshedEvent> { + // Static collaborators + private static final Logger LOG = LoggerFactory.getLogger(RoutesCollector.class); // Collaborators @@ -39,7 +43,7 @@ public class RoutesCollector implements ApplicationListener<ContextRefreshedEven // Constructors public RoutesCollector(List<CamelContextConfiguration> camelContextConfigurations) { - this.camelContextConfigurations = camelContextConfigurations; + this.camelContextConfigurations = new ArrayList<CamelContextConfiguration>(camelContextConfigurations); } // Overridden @@ -76,12 +80,15 @@ public class RoutesCollector implements ApplicationListener<ContextRefreshedEven // Helpers private void loadXmlRoutes(ApplicationContext applicationContext, CamelContext camelContext) { + LOG.debug("Started XML routes detection. Scanning classpath (/camel/*.xml)..."); try { Resource[] xmlRoutes = applicationContext.getResources("classpath:camel/*.xml"); for (Resource xmlRoute : xmlRoutes) { RoutesDefinition xmlDefinition = camelContext.loadRoutesDefinition(xmlRoute.getInputStream()); camelContext.addRouteDefinitions(xmlDefinition.getRoutes()); } + } catch (FileNotFoundException e) { + LOG.debug("No XMl routes found in the classpath (/camel/*.xml). Skipping XML routes detection."); } catch (Exception e) { throw new RuntimeException(e); }