2011-01-04 17 views
0

CXF RESTfulサービスがあり、うまくいきます。問題は、注釈を使用してDAOを注入しようとしたときです:注釈付きBeanがJAX-RS CXFサービスのために注入されない

注入されていません。私の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は春で初期化されつつあると私は、Beanが他の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? –

関連する問題