You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2021/06/21 08:31:00 UTC
[jira] [Resolved] (CAMEL-16733) Calling bean method by type results
in creation of new bean rather using an existing one from the registry
[ https://issues.apache.org/jira/browse/CAMEL-16733?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen resolved CAMEL-16733.
---------------------------------
Assignee: Claus Ibsen
Resolution: Fixed
Thanks for the PR.
> Calling bean method by type results in creation of new bean rather using an existing one from the registry
> -----------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-16733
> URL: https://issues.apache.org/jira/browse/CAMEL-16733
> Project: Camel
> Issue Type: Improvement
> Components: camel-bean
> Affects Versions: 3.10.0
> Reporter: Samrat Dhillon
> Assignee: Claus Ibsen
> Priority: Major
> Fix For: 3.11.0
>
>
> The below code results in creation of a new bean of type MyBean rather than looking up an existing instance from the registry. Also there is an imposition that MyBean has a no-args ctor for camel to construct a new bean. This behaviour is very confusing when an existing bean can be found from the registry such as spring which can use ctor injection without having the need for a default ctor
>
> public void configure() throws Exception {
> from("direct:a").transform().method(MyBean.class).to("mock:a");
> from("direct:b").transform().method(MyBean.class).to("mock:b");
> }
> };
--
This message was sent by Atlassian Jira
(v8.3.4#803005)