Class LazyInitTargetSourceCreator

All Implemented Interfaces:
TargetSourceCreator, Aware, BeanFactoryAware, DisposableBean

public class LazyInitTargetSourceCreator extends AbstractBeanFactoryBasedTargetSourceCreator
TargetSourceCreator that enforces a LazyInitTargetSource for each bean that is defined as "lazy-init". This will lead to a proxy created for each of those beans, allowing to fetch a reference to such a bean without actually initializing the target bean instance.

To be registered as custom TargetSourceCreator for an auto-proxy creator, in combination with custom interceptors for specific beans or for the creation of lazy-init proxies only. For example, as an autodetected infrastructure bean in an XML application context definition:

 <bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
   <property name="beanNames" value="*" /> <!-- apply to all beans -->
   <property name="customTargetSourceCreators">
       <bean class="" />

 <bean id="myLazyInitBean" class="mypackage.MyBeanClass" lazy-init="true">
   <!-- ... -->
Juergen Hoeller, Sam Brannen
See Also: