cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: How to inject a member object into the class in the bus-extensions.txt
Date Thu, 12 Jul 2012 20:55:16 GMT
On Thursday, July 12, 2012 07:55:40 AM XiLai Dai wrote:
> Hi,
> 
> We have a SomethingListener class like this:
> 
> public class SomethingListener implements xxx {
> private MyObj myObj;
> 
> public void setMyObj(MyObj myObj){
>     this.myObj = myObj;
> }
> }
> 
> And add this class into the META-INF/cxf/bus-extensions.txt of the bundle.
> my.SomethingListener::true
> 
> is there a way to pass a MyObj instance to the SomethingListener?

Likely not, no.  The bus-extension stuff is very simplistic.   Your only 
real options are a default constructor or a constructor that takes a Bus 
object.   

Now, you COULD do something like:

publi SomethingListener(Bus b) {
    myObj = bus.getExtension(MyObj.class);
}

or similar which could pull in myObj from another extension.


-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Mime
View raw message