camel处理器中的springbean自动布线
我正在构建OSGI包,以便在Jboss Fuse 6.1容器中运行。项目包含blueprint.xml(在src/main/resourceses/OSGI-INF/blueprint中)。内容如下:camel处理器中的springbean自动布线,spring,apache-camel,osgi,jbossfuse,blueprint-osgi,Spring,Apache Camel,Osgi,Jbossfuse,Blueprint Osgi,我正在构建OSGI包,以便在Jboss Fuse 6.1容器中运行。项目包含blueprint.xml(在src/main/resourceses/OSGI-INF/blueprint中)。内容如下: <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/blueprint"
xmlns:camelcxf="http://camel.apache.org/schema/blueprint/cxf"
xmlns:cxf="http://cxf.apache.org/blueprint/core"
xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint/cxf http://camel.apache.org/schema/blueprint/cxf/camel-cxf.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
http://cxf.apache.org/blueprint/jaxws http://cxf.apache.org/schemas/blueprint/jaxws.xsd
http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd"
>
<bean id="MyProcessor" class="com.test.MyProcessor" />
<camelContext trace="false" id="blueprintContext" xmlns="http://camel.apache.org/schema/blueprint">
<route>
<from uri="activemq:queue:paymentsqueue?username=admin&password=admin" id="NotificationRoute">
<description/>
</from>
<log message="The message contains ${body}"/>
<process ref="MyProcessor"/>
</route>
</camelContext>
</blueprint>
}
但它给了我nullpointerexception。我做错了什么
这是我的spring配置文件的内容(我把它放在src/main/resourcereces/META-INF/spring中)
我认为您没有在spring-like中将处理器MyProcessor声明为bean
<bean id="myProcessor"
class="com.test.MyProcessor" />
应该是@Autowired(这应该是一个输入错误,但指出了它。)我想您还没有在spring-like中将处理器MyProcessor声明为bean
<bean id="myProcessor"
class="com.test.MyProcessor" />
应该是@Autowired(这应该是一个输入错误,但指出了它。)是的,我在复制上面的代码时犯了一个错误。这个bean在blueprint中声明。我编辑过。是的,我在复制上面的代码时犯了一个错误。这个bean在blueprint中声明。我已经编辑过了。一般来说,在blueprint bean中同时使用spring bean是可能的吗?在我的例子中,驼峰路由和处理器是由blueprint创建的,而自动连线bean是由spring创建的。通常,在blueprint bean中可以同时使用spring bean吗?在我的示例中,驼峰路由和处理器是由blueprint创建的,而自动布线bean是由spring创建的。
<bean id="myProcessor"
class="com.test.MyProcessor" />
<process ref="myProcessor"/>
@Aurowired
private Sender sender;