Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ApacheCamel:在使用Spring操作之前设置对象依赖关系_Spring_Apache Camel_Esb - Fatal编程技术网

ApacheCamel:在使用Spring操作之前设置对象依赖关系

ApacheCamel:在使用Spring操作之前设置对象依赖关系,spring,apache-camel,esb,Spring,Apache Camel,Esb,在本例中,我试图在调用businessLogic之前设置对象依赖关系。我收到一个空指针,因为没有设置“使用者”对象 下面是示例的基础,主要是尝试使用Spring DSL 部分:基于计时器的轮询消费者 这是我的camel/spring配置: <bean id="simpleOutboxMessageConsumer" class="org.berlin.camel.esb.logs.mq.SimplePrintMessageConsumer"/> <!-- Cont

在本例中,我试图在调用businessLogic之前设置对象依赖关系。我收到一个空指针,因为没有设置“使用者”对象

下面是示例的基础,主要是尝试使用Spring DSL

部分:基于计时器的轮询消费者

这是我的camel/spring配置:

  <bean id="simpleOutboxMessageConsumer" class="org.berlin.camel.esb.logs.mq.SimplePrintMessageConsumer"/>


  <!-- Continue with spring dsl for ESB -->
  <camelContext id="myCamel" xmlns="http://camel.apache.org/schema/spring">

    <!-- Define a MQ consumer template -->
    <consumerTemplate id="consumer" />

....
   </camelContext>

      <route id="fromOutboxAndConsume">           
          <from uri="timer://foo?period=30000" />
          <to uri="bean:simpleOutboxMessageConsumer?method=businessLogic" />                                        
      </route>
消费对象的用法有一个空指针。我认为spring不仅仅是正确地自动连接bean。即使我没有使用spring,我如何将消费者模板对象传递给这个bean?

这应该可以

<bean id="simpleOutboxMessageConsumer" class="....SimplePrintMessageConsumer">
<property name="consumer" ref="consumer"/>
</bean>

移除@AutoWire,我正在检查@AutoWire为什么不工作,顺便说一句,这应该可以

<bean id="simpleOutboxMessageConsumer" class="....SimplePrintMessageConsumer">
<property name="consumer" ref="consumer"/>
</bean>


移除@AutoWire,我正在检查@AutoWire为什么不工作,顺便问一下

到目前为止,这似乎是最好的方法,直到我看到更好的方法。@EndpointInject(uri=“activemq:consumer”)私有消费者模板消费者;如果这解决了你的问题,你可以把它作为一个答案,并接受它。到目前为止,这似乎是最好的方法,直到我看到一个更好的方法。@EndpointInject(uri=“activemq:consumer”)私有消费者模板消费者;如果这解决了您的问题,您可以将其添加为答案并接受它。