Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-9294

Camel spring boot doesn't pickup routes when context refresh event is not called on the root context

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 2.16.0
    • Fix Version/s: None
    • Component/s: camel-spring-boot
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      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.

      RoutesCollector.java
      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");
              }
      }
      

      If you agree I'll attach a patch.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                davsclaus Claus Ibsen
                Reporter:
                denis.stepanov Denis Stepanov
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: