Hi

Yeah this seems to be improved via CAMEL-18764
When I debug I can see the templates are loaded first despite being 2nd
class, and that only last, routes are created from the template (via
templatedRoute)


On Fri, Dec 16, 2022 at 10:16 AM Claus Ibsen <claus.ib...@gmail.com> wrote:

> Hi
>
> I tried the example for the upcoming 3.20.0 release.
>
> If I run it out of the box with java profile
> mvn spring-boot:run -Dspring-boot.run.profiles=java
>
> Then I see 2 routes logged
> 2022-12-16 10:13:31.009  INFO 38526 --- [ - timer://deux] route4
>                         : Java says Bonjour deux
> 2022-12-16 10:13:31.010  INFO 38526 --- [1 - timer://one] route3
>                         : Java says Hello one
>
> And if I rename the class MyRouteTemplates.java to RouteTemplates.java
> mvn clean spring-boot:run -Dspring-boot.run.profiles=java
>
> Then I also see 2 routes logged
>
> 2022-12-16 10:15:20.914  INFO 38576 --- [1 - timer://one] route3
>                         : Java says Hello one
> 2022-12-16 10:15:20.914  INFO 38576 --- [ - timer://deux] route4
>                         : Java says Bonjour deux
>
> So it may be better in this release, can you try when its released or with
> SNAPSHOT
>
>
>
> On Wed, Nov 2, 2022 at 2:12 PM Michael Rambichler <mich...@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
>


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

Reply via email to