Thats a bit odd as its just OO. But create a JIRA and attach a small unit test, that would be great.
On Tue, Feb 1, 2011 at 3:20 PM, Dan Checkoway <dchecko...@gmail.com> wrote: > Before I report this in JIRA as a bug in Camel 2.6.0, I want to make sure > what I'm trying to do is actually supported. > > When I use @EndpointInject in a bean in my spring app context, the endpoint > gets injected no problem on either a ProducerTemplate or Endpoint. But when > I use @EndpointInject on a *SUPERCLASS* of my bean(s), the endpoint does NOT > get injected and I end up getting a NullPointerException when I try to use > it. > > Pseudo-code below...please let me know if what I'm trying to do should be > supported. I believe this is a bug in the annotation processor, where it's > not processing superclasses. > > // ================= THIS WORKS: > > @Component > public class AllGood { > @Autowired > ProducerTemplate producerTemplate; > @EndpointInject(uri="activemq:queue:my.queue") > Endpoint myQueue; > > public void send() { > producerTemplate.sendBody(myQueue, "body"); > } > } > > // ================= THIS ALSO WORKS: > > @Component > public class AllGood { > @EndpointInject(uri="activemq:queue:my.queue") > ProducerTemplate producerTemplate; > > public void send() { > producerTemplate.sendBody("body"); > } > } > > // ================= THIS DOES NOT WORK: > > public abstract class BaseClass { > @Autowired > ProducerTemplate producerTemplate; > @EndpointInject(uri="activemq:queue:my.queue") > Endpoint myQueue; > > public void send() { > producerTemplate.sendBody(myQueue, "body"); > } > } > > @Component > public class SubClass1 extends BaseClass { > public void doSomeStuff() { > send(); > } > } > > // ================= NEITHER DOES THIS: > > public abstract class BaseClass { > @EndpointInject(uri="activemq:queue:my.queue") > ProducerTemplate producerTemplate; > > public void send() { > producerTemplate.sendBody("body"); > } > } > > @Component > public class SubClass2 extends BaseClass { > public void doSomeStuff() { > send(); > } > } > > // ========================= > > Thanks, > Dan > -- Claus Ibsen ----------------- FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/