62.4. 作成したインスタンスにプロパティーを設定する

エンドポイント URI では、作成されたインスタンスに設定するプロパティーを指定できます (たとえば、setPrefix メソッドがある場合)。

   // Camel 2.17 onwards
   from("direct:start")
        .to("class:org.apache.camel.component.bean.MyPrefixBean?bean.prefix=Bye")
        .to("mock:result");
 
   // Camel 2.16 and older 
   from("direct:start")
        .to("class:org.apache.camel.component.bean.MyPrefixBean?prefix=Bye")
        .to("mock:result");

また、# 構文を使用して、レジストリーで検索するプロパティーを参照することもできます。

    // Camel 2.17 onwards
    from("direct:start")
        .to("class:org.apache.camel.component.bean.MyPrefixBean?bean.cool=#foo")
        .to("mock:result");

    // Camel 2.16 and older
    from("direct:start")
        .to("class:org.apache.camel.component.bean.MyPrefixBean?cool=#foo")
        .to("mock:result");

ID foo でレジストリーから Bean を検索し、MyPrefixBean クラスの作成されたインスタンスで setCool メソッドを呼び出します。

ヒント: class コンポーネントはほとんど同じように機能するため、Bean コンポーネントで詳細を参照してください。