You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by axelr <ar...@ordix.de> on 2015/06/07 23:23:07 UTC

JAX RS Injecting client proxies by Spring: Specified class is an interface

I am trying to use Spring injection described here:
Injecting proxies
<http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-Injectingproxies>  



I am getting the following exception:



Of course CustomerService is an interface. To my opinion it must be an
interface. And to prove that I have used a class instead of this interface
and I am getting: demo.jaxrs.client.CustomerServiceImpl is not an interface.
BTW Using 'JAXRSClientFactory.create' everything works fine.

I have tried this using CXF 3.0.5 and 3.1.0.

What's wrong? Any ideas?




--
View this message in context: http://cxf.547215.n5.nabble.com/JAX-RS-Injecting-client-proxies-by-Spring-Specified-class-is-an-interface-tp5758058.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: JAX RS Injecting client proxies by Spring: Specified class is an interface

Posted by Sergey Beryozkin <sb...@gmail.com>.
Sounds good, thanks for the confirmation,
Sergey
On 08/06/15 13:10, axelr wrote:
> Hi Sergey,
>
> I am sorry, my fault! Because I am not sure whether I got your point, I had
> a more detailed look in the stack trace:
> The exception is thrown by a different bean 'customerBean' not the
> jaxrs-client:client bean (customerService). I was confused by the similar
> name.
> So everything works as documented. Thx!
>
> Regards
> Axel
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/JAX-RS-Injecting-client-proxies-by-Spring-Exception-Specified-class-is-an-interface-tp5758058p5758079.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>


Re: JAX RS Injecting client proxies by Spring: Specified class is an interface

Posted by axelr <ar...@ordix.de>.
Hi Sergey,

I am sorry, my fault! Because I am not sure whether I got your point, I had
a more detailed look in the stack trace:
The exception is thrown by a different bean 'customerBean' not the
jaxrs-client:client bean (customerService). I was confused by the similar
name.
So everything works as documented. Thx!

Regards
Axel



--
View this message in context: http://cxf.547215.n5.nabble.com/JAX-RS-Injecting-client-proxies-by-Spring-Exception-Specified-class-is-an-interface-tp5758058p5758079.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: JAX RS Injecting client proxies by Spring: Specified class is an interface

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi

It does work with Spring itself managing the actual injection, based on 
the stack trace, you write the code yourself by directly requesting a 
jaxrs:client bean.

Try to do create a bean like CustomerServiceProxy with a property 
'customerService' set in Spring to refer to jaxrs:client,  and then in 
your Main class get a CustomerServiceProxy bean from the application 
context.

Or the code like this would also work:

CustomerService proxy = 
((JAXRSClientFactoryBean)ctx.getBean("customerService.proxyFactory")).create(CustomerService.class);

HTH, Sergey


On 07/06/15 22:23, axelr wrote:
> I am trying to use Spring injection described here:
> Injecting proxies
> <http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-Injectingproxies>
>
>
>
> I am getting the following exception:
>
>
>
> Of course CustomerService is an interface. To my opinion it must be an
> interface. And to prove that I have used a class instead of this interface
> and I am getting: demo.jaxrs.client.CustomerServiceImpl is not an interface.
> BTW Using 'JAXRSClientFactory.create' everything works fine.
>
> I have tried this using CXF 3.0.5 and 3.1.0.
>
> What's wrong? Any ideas?
>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/JAX-RS-Injecting-client-proxies-by-Spring-Specified-class-is-an-interface-tp5758058.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>