J'ai un service CXF RESTful qui fonctionne très bien. Le problème est lorsque j'essaie d'injecter mon DAO en utilisant une annotation:Les beans annotés ne sont pas injectés pour le service JAX-RS CXF
@Resource
private MyDAO myDAO;
Il ne s'injecte pas. Mon service JAX-RS est configuré comme ressort donc:
<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>
Le DAO est initialisé par obtenir Spring et je l'ai vérifié le haricot fonctionne dans tous les autres POJO, mais pas le service CXF. En outre, je ne vois pas d'erreur dans les journaux
Est-il possible d'autodiscover ce beans comme je le demande dans cette question connexe http://stackoverflow.com/questions/13520821/autodiscover-jax-rs-resources-with-cxf-in-a-spring-application? –