[ https://issues.apache.org/jira/browse/CAMEL-18862?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17656584#comment-17656584 ]
Eduard Gomoliako commented on CAMEL-18862: ------------------------------------------ {quote}_Look in the camel spring boot git repo_ {quote} Indeed. Thank you for pointing that out. I should've guessed myself 🤦 I'm glad you agreed to remove the {{SpringBootRoutesCollector}} and replace it with the default one.  And thanks for pointing out the {{camelContext.addRoutes}} method. I missed it. > Using Spring Boot Camel Starter the RoutesCollector doesn't see RoutesBuilder > added via Camel Context Registry > -------------------------------------------------------------------------------------------------------------- > > Key: CAMEL-18862 > URL: https://issues.apache.org/jira/browse/CAMEL-18862 > Project: Camel > Issue Type: Improvement > Components: camel-spring-boot > Reporter: Eduard Gomoliako > Assignee: Claus Ibsen > Priority: Minor > Fix For: 3.20.2, 3.21.0 > > > Running Camel Context via Spring Boot Camel Starter the following > configuration doesn't work: > {code:java} > @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"); > } > }); > } > }{code} > 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. -- This message was sent by Atlassian Jira (v8.20.10#820010)