[ 
https://issues.apache.org/jira/browse/CAMEL-25428?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-25428.
---------------------------------
    Resolution: Fixed

Fixed by https://github.com/apache/camel/pull/27536: when the Java sources are 
compiled again on a dev mode reload, the files that declare beans (such as 
beans.yaml) are loaded again too, so every bean is created again from the new 
classes, including a bean that calls a changed bean.

> camel-jbang - dev mode reload keeps the old instance of a bean whose Java 
> source changed
> ----------------------------------------------------------------------------------------
>
>                 Key: CAMEL-25428
>                 URL: https://issues.apache.org/jira/browse/CAMEL-25428
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jbang
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 4.23.0
>
>
> In dev mode (camel run --dev) a Java bean declared in a YAML beans file is 
> recompiled when its source changes, and the routes reload, but the routes 
> keep calling the old bean instance, so the change never takes effect.
> Reproduce with the quick-start/routes example of camel-jbang-examples 
> (routes.camel.yaml, beans.yaml, Greeter.java, application.properties):
> {noformat}
> camel run routes.camel.yaml beans.yaml Greeter.java application.properties 
> --dev
> {noformat}
> beans.yaml declares the bean:
> {noformat}
> - beans:
>     - name: greeter
>       type: "camel.example.Greeter"
>       properties:
>         greeting: "{{greeter.greeting}}"
> {noformat}
> Change the return statement of Greeter.java, e.g. to {{return greeting + ", " 
> + name + "!!! CHANGED";}}. The log says:
> {noformat}
> RouteWatcherReloadStrategy : Routes reloaded summary (total:1 started:1)
> RouteWatcherReloadStrategy :     Started greeting (timer://greet) (source: 
> routes.camel.yaml:4)
> {noformat}
> but the route goes on logging "Hello, Camel!" from the old Greeter. Nothing 
> says the bean was not replaced.
> Expected: a bean of the beans file whose class changed is created again from 
> the new class on reload (or, if that cannot be done, the reload says that a 
> restart is needed). Verified on 4.23.0-SNAPSHOT.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to