简体   繁体   中英

Camel .beanRef deprecated - how now to access container-managed beans in Java DSL route?

As of Apache Camel 2.16.3 in 2015, all of the .beanRef Java DSL routebuilder methods have been deprecated .

Unfortunately, even in 2017 the official Camel documentation still says to use the deprecated .beanRef methods. While the API says to use the .bean(...) methods instead, all of these methods instantiate a new version of the bean or expect an existing one passed in.

My question is, how do I use these methods with the Spring framework to pass in a Spring-managed bean in a Java DSL route and what is the official Camel recommendation?

This similar question was asked in 2015 but the answer is not relevant to my specific question regarding managed beans.

Use .bean("beanRef") , because if the parameter of the ProcessorDefinition.bean(Object bean) method is a String than Camel sets the ref to that bean. ( Relevant source from Camel )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM