41.5. Java DSL Bean 構文
Java DSL には Bean コンポーネントの構文が含まれています。エンドポイント(例: ("bean:beanName"))として Bean を明示的に指定する代わりに
、以下の構文を使用できます。
// 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);