Jboss Fuse 6.1 컨테이너에서 실행하기 위해 OSGI 번들을 구축 중입니다. 프로젝트는 blueprint.xml (src/main/resoureces/OSGI-INF/blueprint에 있음)을 포함합니다. 콘텐츠 :낙타 프로세서에서 스프링 빈을 autowiring
<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>
내 목표는 MyProcessor에서 스프링 빈을 사용하고 있습니다. 이 MyProcessor에 대한 코드입니다 :
public class MyProcessor implements Processor {
@Aurowired
private Sender sender;
@Override
public void process(Exchange x) throws Exception {
log.info("test: " +sender.getSenderId());
}
}
를하지만 나에게 NullPointerException이 있습니다. 내가 뭘 잘못하고 있니?
이 내 스프링 구성 파일의 내용입니다
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<context:annotation-config/>
<context:component-scan base-package="com.username"/>
<bean id="sender" class="com.username.Sender" scope="prototype">
<property name="senderId" value="sendername" />
<property name="password" value="senderpassword" />
</bean>
일반적는 \t 동시에 청사진 콩 스프링 빈을 사용할 수있다? 내 예제에서와 같이 낙타 경로와 프로세서가 청사진으로 만들었지 만 봄에 의해 만들어지는 빈을 autowiring합니다. – Maciavelli