This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new 06deb217e76 camel-jbang - Hot reload of beans in yaml-dsl 06deb217e76 is described below commit 06deb217e76fc2f5dce7f7b6ad0568ceb168acbb Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Wed Aug 3 13:14:55 2022 +0200 camel-jbang - Hot reload of beans in yaml-dsl --- .../org/apache/camel/dsl/yaml/deserializers/BeansDeserializer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/main/java/org/apache/camel/dsl/yaml/deserializers/BeansDeserializer.java b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/main/java/org/apache/camel/dsl/yaml/deserializers/BeansDeserializer.java index 7432d2f38e7..c29a6fc66d7 100644 --- a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/main/java/org/apache/camel/dsl/yaml/deserializers/BeansDeserializer.java +++ b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/main/java/org/apache/camel/dsl/yaml/deserializers/BeansDeserializer.java @@ -60,8 +60,11 @@ public class BeansDeserializer extends YamlDeserializerSupport implements Constr @Override public void configure(CamelContext camelContext) { try { + // to support hot reloading of beans then we need to unbind old existing first + String name = bean.getName(); + camelContext.getRegistry().unbind(name); camelContext.getRegistry().bind( - bean.getName(), + name, bean.newInstance(camelContext)); } catch (Exception e) { throw new RuntimeException(e);