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

Using Spring Boot Camel Starter the RoutesCollector doesn't see RoutesBuilder added via Camel Context Registry

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 3.20.2, 3.21.0
    • camel-spring-boot
    • None
    • Unknown

    Description

      Running Camel Context via Spring Boot Camel Starter the following configuration doesn't work:

      @Configuration
      public class ContextConfiguration {
        @Inject
        CamelContext camelContext;
      
        @PostConstruct
        public void init() {
          camelContext.getRegistry().bind("my-routes", new RoutesBuilder() {
            public void configure() {
              from("direct:input").to("direct:output");
            }
          });
        }
      }

      The reason seems to be in the SpringBootRoutesCollector class implementation that overrides the findByType method and makes it to use Spring ApplicationContext directly.

      Considering that being bootstrapped via Spring Boot the Camel Context Registry looks the beans up in the Spring Application Context with a fallback to the default registry, the SpringBootRoutesCollector class is redundant and doesn't provide any additional value having only the mentioned findByType method overridden.

       

      Should my analysis be incorrect, it would be nice to learn about the reasoning behind the SpringBootRoutesCollector class.

      I appreciate your consideration. 

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            Gomoliako Eduard Gomoliako
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: