在骆驼上下文中定义的路由中,我想访问我正在使用的第 3 方库中包含的抽象类的方法。
<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>
...
上面的代码片段显示了 Spring DSL 中的路由定义和抽象 bean 的定义。我曾尝试使用<bean>
标签来实现我想要的,但这总是以org.springframework.beans.factory.BeanIsAbstractException
. 有没有办法简单地访问camelcontext中抽象类的静态方法?