users@jersey.java.net

Re: [Jersey] Jersey Client and Spring

From: Lars Tackmann <lars_at_randompage.org>
Date: Tue, 16 Dec 2008 20:57:45 +0100

On Tue, Dec 16, 2008 at 7:57 PM, Andrew Ochsner
<aochsner_at_cs.stanford.edu> wrote:
> Hi all:
>
> Hoping this is easy, but is there any easy, straighforward way to configure
> a Client or a WebResource via Spring? I see references to IOC support, but
> it's not clear to me if there is a path. I want to configure the endpoints
> in Spring xml and have the class that wants to make REST calls be rather
> ignorant.

You could properly get away with adding a factory to spring, like this
(warning untested code):

<bean id="usesRest" class="com.foo.SomeController">
       <property name="client">
           <bean factory-method="create"
class="com.sun.ws.rest.api.client.Client" />
      </property>
</bean>

-- 
Yours sincerely
Lars Tackmann