I have a bean defined with the annotation.I tried using CamelBeanPostProcessor but the camelContext is null.
public class HelloWorld {
@EndpointInject(uri="direct:copy")
private ProducerTemplate template;
public final void speak(Exchange e) {
template.sendBody("A new message");
}
public ProducerTemplate getTemplate() {
return template;
}
public void setTemplate(ProducerTemplate template) {
this.template = template;
}
}
There are quite a lot of ways of achieving this. As your bean is a processor, you can simply implement Processor and then have access to the entire exchange, and of course camelcontext as well: