Dear Spring Users,
I've recently encountered an issue while injecting my beans, I'll try to give a short explaination which will hopefully be enough for your Spring-guru's!
I have to call some SOAP webservice, where I generated the classes from the necessary WSDL. (Done with Apache CXF).
At this point I have some POJO's, a webservice class and a PortType class.
<!-- WEB SERVICE -->
<bean id="updateDossierSOAP" class="dostk.updatedossierws_tws.UpdateDossierWS"
factory-bean="updateDossierSOAPFactory" factory-method="create">
</bean>
<bean id="updateDossierSOAPFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean" >
<property name="serviceClass" value="dostk.updatedossierws_tws.UpdateDossierWSPo rtType" />
<property name="address" value="http://some-url-to-my-service/webservices/DOSTK/UpdateDossierWS.tws" />
<property name="properties">
<map>
<entry key="schema-validation-enabled" value="true" />
</map>
</property>
</bean>
I have my factory and it needs to create my PortType class which I will use to call my webserver (UpdateDossierWSPortType).
So here's the issue. In my class when I use @Autowiring (and the other examples below), it keeps telling me it cannot find a matching bean of type UpdateDossierWSPortType.
@Autowired
private UpdateDossierWSPortType updateDossierSOAP;
@Inject
@Named("updateDossierSOAP")
private UpdateDossierWSPortType updateDossierSOAP;
@Autowired
@Qualifier("updateDossierSOAP")
None of the above tests will load up my service class, I will keep getting "No matching bean of type found.."
Caused by: org.springframework.beans.factory.BeanCreationExce ption: Could not autowire field: private dostk.updatedossierws_tws.UpdateDossierWSPortType be.aquafin.dao.impl.ProjectDaoImpl.updateDossierSO AP; nested exception is org.springframework.beans.factory.NoSuchBeanDefini tionException: No matching bean of type [dostk.updatedossierws_tws.UpdateDossierWSPortType] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Aut owired(required=true)}
Only when I use the @Resource annotation, it will be injected without any problem.
I'm trying to figure out what is going wrong with using the @Autowired/@Inject annotations and what I have to do to get it working.
Strange thing as well is the error message is talking about the type which is not found, but even when I change my applicationContext.xml to use autowiring by name (default-autowire="byName"), it will still give the same error.
Any advice, thoughts?
Thanks in advance!




Reply With Quote
