Methods 使用SpringDSL访问骆驼上下文版本(2.9.1)中抽象类的方法

Methods 使用SpringDSL访问骆驼上下文版本(2.9.1)中抽象类的方法,methods,abstract-class,apache-camel,spring-dsl,Methods,Abstract Class,Apache Camel,Spring Dsl,在camel上下文中定义的路由中,我希望访问包含在我正在使用的第三方库中的抽象类的方法 <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:osgi="http://www.sprin

在camel上下文中定义的路由中,我希望访问包含在我正在使用的第三方库中的抽象类的方法

 <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:osgi="http://www.springframework.org/schema/osgi"
   xsi:schemaLocation="
   http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
   http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd
   http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> 


 <bean id="objectFactory" class="org.example.Factory" abstract="true"/>

 <camelContext xmlns="http://camel.apache.org/schema/spring">
     <route>
         ...
       <marshal>
          <rss/>
   </marshal>
   <marshal>
      <string/>
   </marshal>
       <to uri="jms:feeds"/>
       <to uri="file:/tmp/output"/>
       <!-- That is the point in the route where I would like to pass the URL of 
            the folder the files have been written to a static method of an abstract
            class in order to instantiate an object
       -->
     </route>
      ...

...
...

上面的代码片段显示了SpringDSL中的路由定义和抽象bean的定义。我已经尝试使用
标记来实现我想要的,但这总是以
org.springframework.beans.factory.beanisactException
结束。没有办法在camelcontext中简单地访问抽象类的静态方法吗?

如果该方法是静态方法,您可以直接在CamelDSL中引用它

<bean type="org.example.Factory" method="myMethod"/>


请注意,这需要一个相当新的Camel版本,其中我们添加了对直接调用静态方法的支持。

我认为使用抽象类最简单的方法是定义自己的类来扩展抽象类,然后调用它。然后可以使用正常的bean语法,如上面提到的Claus。在这种情况下,非静态方法也会起作用。

谢谢您的快速回答。我通过使用Camel-Spring-DM原型尝试了这一点:
Yes内部有Camel名称空间,并且还有一个从路由调用bean的标记。