Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-16733

Calling bean method by type results in creation of new bean rather using an existing one from the registry

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.10.0
    • Fix Version/s: 3.11.0
    • Component/s: camel-bean
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      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"); }

      };

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              samrat.dhillon Samrat Dhillon
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: