I have a couple of bean declarations in my camel-context.xml. How can I use them in a Processor class or similar?

Solution Unverified - Updated -

Environment

  • Fuse Mediation Router 2.x

Issue

I have "" instances declared in my CamelContext. Is there any way to access them as ordinary Spring beans in my java code?

Resolution

The org.apache.camel.spi.Registry will allow you to lookup the spring beans.

In your Java code you can do it as follows:

Object myBean = camelContext.getRegistry().lookup("myBean");

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments