Created
January 21, 2011 11:37
-
-
Save sixman9/789562 to your computer and use it in GitHub Desktop.
How to setup a lazy-loaded bean in Spring.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Lazy load (at request time) a Spring bean --> | |
<bean id="someBeanLazy" class="org.springframework.aop.framework.ProxyFactoryBean"> | |
<property name="targetSource"> | |
<bean class="org.springframework.aop.target.LazyInitTargetSource"> | |
<property name="targetBeanName" value="someRealBean" /> | |
<property name="targetClass"> | |
<bean class="java.lang.Class" factory-method="forName"> | |
<constructor-arg value="com.package.TheClassToMakeLazy"/> | |
</bean> | |
</property> | |
</bean> | |
</property> | |
</bean> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment