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 387ae106ca1 CAMEL-22053: camel-jbang - Add support for @Inject on bean method that produces a bean 387ae106ca1 is described below commit 387ae106ca1be2b86fb5f2280f05fc89924e7133 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Thu May 8 13:18:46 2025 +0200 CAMEL-22053: camel-jbang - Add support for @Inject on bean method that produces a bean --- .../camel/main/injection/AnnotationDependencyInjection.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/injection/AnnotationDependencyInjection.java b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/injection/AnnotationDependencyInjection.java index bb2a8892f99..2c00d4ac003 100644 --- a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/injection/AnnotationDependencyInjection.java +++ b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/injection/AnnotationDependencyInjection.java @@ -345,14 +345,16 @@ public final class AnnotationDependencyInjection { @Override public void onMethodInject(Method method, Object bean, String beanName) { Produces produces = method.getAnnotation(Produces.class); + Inject inject = method.getAnnotation(Inject.class); Named bi = method.getAnnotation(Named.class); - if (produces != null || bi != null) { + if (produces != null || inject != null || bi != null) { + String an = produces != null ? "Produces" : "Inject"; Object instance; if (lazyBean) { instance = (Supplier<Object>) () -> helper.getInjectionBeanMethodValue(context, method, bean, beanName, - "Produces"); + an); } else { - instance = helper.getInjectionBeanMethodValue(context, method, bean, beanName, "Produces"); + instance = helper.getInjectionBeanMethodValue(context, method, bean, beanName, an); } if (instance != null) { String name = method.getName();