To process exchange objects using a Java bean you use the
bean processor. The bean processor
uses two attributes to binds the inbound exchange to a method on the Java object:
ref—a reference to the Spring bean that injects the Java objectmethod—the name of the method to use for exchange processing
Example 5.1 shows a route that uses the bean
MyBeanProcessorto process inbound exchanges.
Example 5.1. Using a Java bean
<bean id="MyBeanProcessor" class="MyBeanProcessor" /> ... <camelContext> <from uri="file:data/inbound" /> <bean ref="MyBeanProcessor" method="processBody" /> <to uri="file:data/outbound" /> </camelContext>
The bean processor creates an instance of
MyBeanProcessor type and invokes the processBody() method to
process inbound exchanges.








