2011-01-04 4 views
0

CXF RESTful 서비스가 정상적으로 작동합니다. 문제는 주석을 사용하여 DAO를 주입하려고 할 때입니다.JAX-RS CXF 서비스에 주석 처리 된 Bean이 주입되지 않음

@Resource 
private MyDAO myDAO; 

주입되지 않습니다. 내 JAX-RS 서비스는 봄과 같이 구성되어 있습니다 :

<beans xmlns="http://www.springframework.org/schema/beans" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xmlns:jaxws="http://cxf.apache.org/jaxws" 
     xmlns:jaxrs="http://cxf.apache.org/jaxrs" 
     xmlns:cxf="http://cxf.apache.org/core" 
     xsi:schemaLocation=" 
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd 
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd 
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd 
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd"> 


    <import resource="classpath:META-INF/cxf/cxf.xml"/> 
    <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml"/> 
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/> 

    <jaxrs:server id="message" serviceClass="com.foo.MessageResourceImpl" address="/"> 
    <jaxrs:features> 
     <cxf:logging/> 
    </jaxrs:features> 
    </jaxrs:server> 
</beans> 

DAO는 Spring에 의해 초기화지고 난 콩이, 다른 POJO에 불과하지 CXF 서비스를 작동 확인했습니다. 또한, 나는이 솔루션은 serviceBeans에있는 로그

답변

0

에 오류가 표시되지 않습니다

<jaxrs:serviceBeans> 
    <bean class="com.foo.MessageResourceImpl"/> 
</jaxrs:serviceBeans> 

@serviceClass를 사용하여, CXF는 클래스가 아닌 봄을 인스턴스화합니다.

+0

이 관련 질문에서 내가 콩을 자동으로 검색 할 수 있습니까? http://stackoverflow.com/questions/13520821/autodiscover-jax-rs-resources-with-cxf-in-a-spring-application? –

관련 문제