You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Claus Ibsen <cl...@gmail.com> on 2022/12/16 09:01:44 UTC

Re: Route Template and dependency to Spring Boot Component Order initialization

Hi

Sorry for the late reply.
Yeah we should make using this out of the box better on SB.
Can you create a JIRA ticket.

On top of my mind, then Spring Boot may have some annotation/interface that
can be implemented to specify priority/ordering.
And we have that in Camel as well with org.apache.camel.Ordered (I think).

Because if you use RouteBuilder to build route templates then Camel cannot
know just by the class that its template or not.
So we may also consider some interface where you can mark the class to say
it has templates, and therefore should be loaded first.




On Wed, Nov 2, 2022 at 2:12 PM Michael Rambichler <mi...@rambichler.at>
wrote:

> Hi all,
>
> we are heavily using route templates with camel 3.18.x and Spring boot
> 2.7.3
>
> I still wonder if there is no better possibility to avoid the spring boot
> component scan order dependency.
>
> To reproduce the issue: check out the example from
>
> https://github.com/apache/camel-spring-boot-examples/tree/main/routetemplate
> and rename the MyRouteTemplates.java to RouteTemplates.java
>
> There we are, your spring boot will initialize your RouteTemplate
> (RouteTemplates.class) class* after* the RouteBuilder
> (MyTemplateBuilder.class) and fails with: Cannot find RouteTemplate with id
> myTemplate
>
> Are there any better approaches to avoid this Spring Component Scan
> ordering?
>
> BR
>  Michael
>


-- 
Claus Ibsen
-----------------
@davsclaus
Camel in Action 2: https://www.manning.com/ibsen2