Hi

Implementations classes are also supported, just do

MyServiceImpl service  =
JAXRSClientFactory.create("http://localhost:9000/services";,
MyServiceImpl.class);

you'll need a CGLIB nodep jat on the classpath. It will still be a proxy,
but a CGLIB based one so you should be able to inject

cheers, Sergey

On Tue, Jul 20, 2010 at 6:11 PM, cxfJim <[email protected]> wrote:

>
> I am currently struggeling with an issue which is only of importance in
> unit
> tests. I have a REST-service interface including the annotated service
> MyService with the method foo(). Now an implementation MyServiceImpl is
> derived adding a setter for a property which shall be exchangable
> especially
> for testing purposes, say, its a printerComponent.
>
> So for a test it is needed to exchange the default printerComponent through
> a dummy object:
> MyServiceImpl myServiceImpl = new MyServiceImpl();
> myServiceImpl.setPrinterComponent( new DummyPrinterComponent() );
>
> In my unit test I want to call the real REST-Method via Proxy, so I use:
>
> MyService service  =
> JAXRSClientFactory.create("http://localhost:9000/services";,
> MyService.class);
>
> Now I have the problem that I have no chance to inject the
> dummyPrinterComponent as I get only a proxy. I hoped that I can register
> the
> implementing class within the client factory, but it seems that only
> interface types are supported.
>
> Is there any way of working with the implementing class? Of course I don't
> want to add the implementation dependend setter/getter method into the
> service interface.
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/JAXRS-Initializing-Service-Proxy-through-implementation-class-tp1627376p1627376.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>

Reply via email to