Claus Ibsen created CAMEL-25428:
-----------------------------------
Summary: 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
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)