43.5. Java DSL Bean 構文
Java DSL には、Bean コンポーネントのシンタックスシュガーが付属しています。Bean を明示的にエンドポイント (つまり to ("bean:beanName")) として指定する代わりに、次の構文を使用できます。
// Send message to the bean endpoint
// and invoke method resolved using Bean Binding.
from("direct:start").beanRef("beanName");
// Send message to the bean endpoint
// and invoke given method.
from("direct:start").beanRef("beanName", "methodName");Bean への参照の名前を渡す代わりに (Camel がレジストリーでそれを検索できるようにするため)、Bean 自体を指定できます。
// Send message to the given bean instance.
from("direct:start").bean(new ExampleBean());
// Explicit selection of bean method to be invoked.
from("direct:start").bean(new ExampleBean(), "methodName");
// Camel will create the instance of bean and cache it for you.
from("direct:start").bean(ExampleBean.class);