43.5. Java DSL 빈 구문
Java DSL은 빈 구성 요소에 대한 구문 분석 설 탕과 함께 제공됩니다. 빈을 엔드포인트(예: ("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");
빈에 참조 이름을 전달하는 대신( Camel이 레지스트리에서 해당 참조를 조회할 예정) 빈 자체를 지정할 수 있습니다.
// 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);