1 16 17 package org.springframework.aop.target; 18 19 import junit.framework.TestCase; 20 21 import org.springframework.beans.TestBean; 22 import org.springframework.beans.factory.xml.XmlBeanFactory; 23 import org.springframework.core.io.ClassPathResource; 24 25 29 public class LazyInitTargetSourceTests extends TestCase { 30 31 public void testLazyInitSingletonTargetSource() { 32 XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("lazyInitSingletonTests.xml", getClass())); 33 bf.preInstantiateSingletons(); 34 TestBean tb = (TestBean) bf.getBean("proxy"); 35 assertFalse(bf.containsSingleton("target")); 36 assertEquals(10, tb.getAge()); 37 assertTrue(bf.containsSingleton("target")); 38 } 39 40 } 41 | Popular Tags |