cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Roberts <>
Subject Re: Lazy instantiation of Web Service Client
Date Tue, 12 Feb 2008 23:30:16 GMT
Ian Roberts wrote:
> The LazyProxyFactoryBean shown in this post basically allows you to wrap 
> up another Spring bean with a proxy that shows the same interface, but 
> delays asking for the "real" bean until the first method call.  Using 
> this in combination with the lazy-init=true trick above should do what 
> you're after.

In fact, it turns out Spring has built-in support for exactly this using 
the AOP ProxyFactoryBean:

<bean id="accountProxyFactory"
   <property name="serviceClass" value="my.web.service.AccountService"/>
   <property name="address" value="${account.service}"/>

<bean id="realAccountService" class="my.web.service.AccountService"
       factory-bean="accountProxyFactory" factory-method="create"

<bean id="accountService"
   <property name="targetSource">
     <bean class="">
       <property name="targetBeanName">
         <idref local="realAccountService"/>
   <property name="proxyInterfaces"
             value="my.web.service.AccountService" />


Ian Roberts               | Department of Computer Science  | University of Sheffield, UK

View raw message