You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Joshua Partogi <jo...@gmail.com> on 2008/11/05 14:31:04 UTC

Injecting a bean from an endpoint

Dear all,

How do I inject a spring bean from a JAX-WS endpoint? How do I
configure this in the spring xml? Could anyone give me a clue on this?

Thank you.

-- 
Not by might nor by power, but by His Spirit.

Read my blog: http://joshuajava.wordpress.com/
Follow me on twitter: http://twitter.com/jpartogi

Re: Injecting a bean from an endpoint

Posted by Joshua Partogi <jo...@gmail.com>.
On Thu, Nov 6, 2008 at 7:54 AM, Daniel Kulp <dk...@apache.org> wrote:
>
>
> There really are two options:
>
> 1) Use spring to actually create your ServiceImpl and use spring injection.
>
> <bean id="myservice" class="....ServiceImpl">
>    <property name="bean" ref="refBean"/>
> </bean>
> <jaxws:endpoint implementor="#myservice" .../>
>
>
> 2)  Use an @Resource thing:
>  @WebService
>  public class ServiceImpl implements Service{
>    @Resouce(name = "myBean")
>    public SpringBean bean;
>  }

Thanks Dan. I'm going to work it out. I like the annotation option.



-- 
Not by might nor by power, but by His Spirit.

Read my blog: http://joshuajava.wordpress.com/
Follow me on twitter: http://twitter.com/jpartogi

Re: Injecting a bean from an endpoint

Posted by Daniel Kulp <dk...@apache.org>.

There really are two options:

1) Use spring to actually create your ServiceImpl and use spring injection.   

<bean id="myservice" class="....ServiceImpl">
    <property name="bean" ref="refBean"/>
</bean>
<jaxws:endpoint implementor="#myservice" .../>


2)  Use an @Resource thing:
 @WebService
 public class ServiceImpl implements Service{
    @Resouce(name = "myBean")
    public SpringBean bean;
 } 


Dan

On Wednesday 05 November 2008 3:18:05 pm Joshua Partogi wrote:
> Hi Glen,
>
> Thanks for replying.
>
> See in my endpoint let's say I have a bean as such:
>
> @WebService
> public class ServiceImpl implements Service{
>    public SpringBean bean;
> }
>
> Now how do I inject this bean from spring bean xml config? What do I
> put inside the jaxws:endpoint element?
> <jaxws:endpoint id="service"
>   ...>
>
> </jaxws:endpoint>
>
> I still haven't got the gist of CXF yet.
>
> Thanks in advance
>
> On Thu, Nov 6, 2008 at 1:13 AM, Glen Mazza <gl...@gmail.com> wrote:
> > Would the first and third code segments of Step #2 here[1] be what you're
> > looking for?
> >
> > [1] http://www.jroller.com/gmazza/date/20080716



-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

Re: Injecting a bean from an endpoint

Posted by Joshua Partogi <jo...@gmail.com>.
Hi Glen,

Thanks for replying.

See in my endpoint let's say I have a bean as such:

@WebService
public class ServiceImpl implements Service{
   public SpringBean bean;
}

Now how do I inject this bean from spring bean xml config? What do I
put inside the jaxws:endpoint element?
<jaxws:endpoint id="service"
  ...>

</jaxws:endpoint>

I still haven't got the gist of CXF yet.

Thanks in advance

On Thu, Nov 6, 2008 at 1:13 AM, Glen Mazza <gl...@gmail.com> wrote:
>
> Would the first and third code segments of Step #2 here[1] be what you're
> looking for?
>
> [1] http://www.jroller.com/gmazza/date/20080716
>

-- 
Not by might nor by power, but by His Spirit.

Read my blog: http://joshuajava.wordpress.com/
Follow me on twitter: http://twitter.com/jpartogi

Re: Injecting a bean from an endpoint

Posted by Glen Mazza <gl...@gmail.com>.
Would the first and third code segments of Step #2 here[1] be what you're
looking for? 

[1] http://www.jroller.com/gmazza/date/20080716

Glen


Joshua Partogi wrote:
> 
> Dear all,
> 
> How do I inject a spring bean from a JAX-WS endpoint? How do I
> configure this in the spring xml? Could anyone give me a clue on this?
> 
> Thank you.
> 
> -- 
> Not by might nor by power, but by His Spirit.
> 

-- 
View this message in context: http://www.nabble.com/Injecting-a-bean-from-an-endpoint-tp20341734p20342457.html
Sent from the cxf-user mailing list archive at Nabble.com.