60.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 で Registry から Bean を検索し、MyPrefixBean クラスの作成されたインスタンスで setCool メソッドを呼び出します。
TIP: クラス コンポーネントがほぼ同じ方法で機能するため、Bean コンポーネントで詳細を確認してください。