You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Eduard Gomoliako (Jira)" <ji...@apache.org> on 2023/01/05 08:24:00 UTC

[jira] [Comment Edited] (CAMEL-18862) Using Spring Boot Camel Starter the RoutesCollector doesn't see RoutesBuilder added via Camel Context Registry

    [ https://issues.apache.org/jira/browse/CAMEL-18862?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17654615#comment-17654615 ] 

Eduard Gomoliako edited comment on CAMEL-18862 at 1/5/23 8:23 AM:
------------------------------------------------------------------

Good question.

I need to register a bunch of RoutesBuilders that I generated based on the
database contents.

I need several of them because I’d like to reload only a bunch of routes
that are associated with a single DB resource.

I didn’t find a better way to register a collection.

Though in my opinion, it’s another separate issue.

The point is that I’m questioning the existence of the
{{SpringBootRoutesCollector}}
class.

BR,
Ed


was (Author: JIRAUSER292949):
Good question.

I need to register a bunch of RoutesBuilders that I generated based on the
database contents.

I need several of them because I’d like to reload only a bunch of routes
that are associated with a single DB resource.

I didn’t find a better way to register a collection.

Though to my opinion it’s another separate issue.

The point is that I’m questioning the existence of the
{{SpringBootRoutesCollector}}
class.

BR,
Ed




> 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: Bug
>          Components: camel-spring-boot
>            Reporter: Eduard Gomoliako
>            Priority: Minor
>
> 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)