You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Denis Stepanov (JIRA)" <ji...@apache.org> on 2015/11/05 21:21:27 UTC

[jira] [Created] (CAMEL-9294) Camel spring boot doesn't pickup routes when context refresh event is not called on the root context

Denis Stepanov created CAMEL-9294:
-------------------------------------

             Summary: Camel spring boot doesn't pickup routes when context refresh event is not called on the root context
                 Key: CAMEL-9294
                 URL: https://issues.apache.org/jira/browse/CAMEL-9294
             Project: Camel
          Issue Type: Bug
          Components: camel-spring-boot
    Affects Versions: 2.16.0
            Reporter: Denis Stepanov


RoutesBuilders doesn't get picked-up when Spring Cloud Config is included on the classpath, I think it uses some mechanism for properties refresh, by that, application context is ignored and code bellow will not do the initialisation.

My propose would be to always initialise and log an additional information if you think there could be a problem without the root context. 

{code:title=RoutesCollector.java|borderStyle=solid}
public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
 ApplicationContext applicationContext = contextRefreshedEvent.getApplicationContext();
        if (applicationContext.getParent() == null) {
           // This will not get called when Spring Cloud Config is included on classpath
        } else {
            LOG.debug("Not at root context - defer adding routes");
        }
}
{code}

If you agree I'll attach a patch.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)