I don't thing the @Produce can be used for the ProducerTemplate.
Please take a look at this example[1][2] [1]https://svn.apache.org/repos/asf/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/produce/ProduceTemplateTest.java [2]https://svn.apache.org/repos/asf/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/produce/ProduceTemplateTest-context.xml Willem ---------------------------------- Apache Camel, Apache CXF committer Open Source Integration http://www.fusesource.com Blog http://willemjiang.blogspot.com Tiwtter http://twitter.com/willemjiang unixployd wrote:
I have next code: public class ProcessorProducer {private Log log = LogFactory.getLog(getClass()); @Produce(uri="activemq:foo.bar")protected ProducerTemplate producer;public void sendMsg(){log.info("producer=" + producer ); producer.sendBody("Hello!"); } } and applcationContext.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/spring" xmlns:context="http://www.springframework.org/schema/context" xmlns:amq="http://activemq.apache.org/schema/core" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd"> <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"/> <bean id="processorProducer" class="yyy.ProcessorProducer"/> </beans> When executing method sendMsg, I am getting NPE. What's wrong? it seems that Spring Post Processor doesn't handle injecting@Produce for the class ProcessorProducer...
