You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by paolocollector <pa...@yahoo.com> on 2009/02/12 19:23:54 UTC
cxf - Spring autowire Problem
Hi all
i am having trouble using Spring 2.5 annotation with cxf
I reduced all tha application to a mini manager and a webservice
the manager code is
@Service
public class MiniManagerImpl implements MiniManager {
[...]
and the webservice
@WebService(endpointInterface = "minitest.service.MiniService", serviceName
= "MiniService")
public class MiniServiceImpl extends AbstractBaseServiceImpl implements
MiniService {
@Autowired
private MiniManager miniManager;
[...]
I did this other times the same way in a web application, and the autowire
always worked.
However this time it seems to ignore me, there is no injection and
miniManager is always null.
The webservice works, it trace my messages and anithing else, it just can't
call the manager (that is null).
I checked the config files and the auto scan
<context:component-scan base-package="minitest"
scoped-proxy="targetClass" />
(package is correct)
Anybody can help me? What am i missing?
Why Spring should ignore the autowire when the request comes from a cxf
webservice?
Thanks a lot
Paolo
--
View this message in context: http://www.nabble.com/cxf---Spring-autowire-Problem-tp21981931p21981931.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: cxf - Spring autowire Problem
Posted by paolocollector <pa...@yahoo.com>.
Ok, it works now.
I had to put the bean declaration in the ApplicationContext.xml
and the jaxws:endpoint declaration in the cxf.xml
I am not sure why, but this way it does work.
The only problem left is that I had to move the cllient in a different
project because it doesn't like the line
implementor="#MiniServiceImpl"
and i had to change it into
implementor="minitest.service.impl.MiniServiceImpl"
Tanks a lot, Dan
Paolo
Change to something like:
<bean id="MyImpl" class="minitest.service.impl.MiniServiceImpl"/>
<jaxws:endpoint id="miniservice"
implementor="#MyImpl"
address="/MiniService">
<jaxws:properties>
I think there are a couple examples similar to that in the docs someplace.
Basically, you want your impl to be created with a standard swing <bean>
tag.
Thus, Spring will inject things. Then just reference it from the endpoint
tag.
Dan
--
View this message in context: http://www.nabble.com/cxf---Spring-autowire-Problem-tp21981931p21994605.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: cxf - Spring autowire Problem
Posted by Daniel Kulp <dk...@apache.org>.
Change to something like:
<bean id="MyImpl" class="minitest.service.impl.MiniServiceImpl"/>
<jaxws:endpoint id="miniservice"
implementor="#MyImpl"
address="/MiniService">
<jaxws:properties>
I think there are a couple examples similar to that in the docs someplace.
Basically, you want your impl to be created with a standard swing <bean> tag.
Thus, Spring will inject things. Then just reference it from the endpoint
tag.
Dan
On Thu February 12 2009 1:47:45 pm paolocollector wrote:
> Woaw this was quick, thanks Dan!
>
> I just have this in cxf.xml:
>
> <jaxws:endpoint id="miniservice"
> implementor="minitest.service.impl.MiniServiceImpl"
> address="/MiniService">
> <jaxws:properties>
>
> I am sure you are right, Spring does not know about my webservice.
>
> I thought that putting
> @WebService(endpointInterface = "minitest.service.MiniService",
> serviceName = "MiniService")
> before the method was enough, like inserting @Service in front of my
> service.
> Obviously i was wrong, but I don't know where else I should put something
>
>
>
>
>
>
> What does your jaxws:endpoint config look like? If you aren't using a ref
> to
> a spring defined bean for MiniServiceImpl, then spring wouldn't have
> created it and nothing would have gotten injected.
>
> Dan
--
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog
Re: cxf - Spring autowire Problem
Posted by paolocollector <pa...@yahoo.com>.
Woaw this was quick, thanks Dan!
I just have this in cxf.xml:
<jaxws:endpoint id="miniservice"
implementor="minitest.service.impl.MiniServiceImpl"
address="/MiniService">
<jaxws:properties>
I am sure you are right, Spring does not know about my webservice.
I thought that putting
@WebService(endpointInterface = "minitest.service.MiniService",
serviceName = "MiniService")
before the method was enough, like inserting @Service in front of my
service.
Obviously i was wrong, but I don't know where else I should put something
What does your jaxws:endpoint config look like? If you aren't using a ref
to
a spring defined bean for MiniServiceImpl, then spring wouldn't have created
it and nothing would have gotten injected.
Dan
--
View this message in context: http://www.nabble.com/cxf---Spring-autowire-Problem-tp21981931p21982421.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: cxf - Spring autowire Problem
Posted by Daniel Kulp <dk...@apache.org>.
What does your jaxws:endpoint config look like? If you aren't using a ref to
a spring defined bean for MiniServiceImpl, then spring wouldn't have created
it and nothing would have gotten injected.
Dan
On Thu February 12 2009 1:23:54 pm paolocollector wrote:
> Hi all
>
> i am having trouble using Spring 2.5 annotation with cxf
>
> I reduced all tha application to a mini manager and a webservice
>
> the manager code is
>
> @Service
> public class MiniManagerImpl implements MiniManager {
> [...]
>
> and the webservice
>
> @WebService(endpointInterface = "minitest.service.MiniService", serviceName
> = "MiniService")
> public class MiniServiceImpl extends AbstractBaseServiceImpl implements
> MiniService {
>
> @Autowired
> private MiniManager miniManager;
> [...]
>
> I did this other times the same way in a web application, and the autowire
> always worked.
> However this time it seems to ignore me, there is no injection and
> miniManager is always null.
> The webservice works, it trace my messages and anithing else, it just can't
> call the manager (that is null).
>
> I checked the config files and the auto scan
> <context:component-scan base-package="minitest"
> scoped-proxy="targetClass" />
> (package is correct)
>
> Anybody can help me? What am i missing?
> Why Spring should ignore the autowire when the request comes from a cxf
> webservice?
>
> Thanks a lot
> Paolo
--
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog