1.prototype 每次对bean的请求生成一个新的的类.
2.singleton 每次获取的是同一个类,默认是这个
<bean id="testScopeDaoImpl" class="org.ymm.dao.impl.TestScopeDaoImpl" scope="prototype"></bean>
2.singleton 每次获取的是同一个类,默认是这个
<bean id="testScopeDaoImpl" class="org.ymm.dao.impl.TestScopeDaoImpl" scope="singleton"></bean>
BeanFactory bf=new ClassPathXmlApplicationContext("beans.xml");
ITestScopeDao ts1 = bf.getBean("testScopeDaoImpl",ITestScopeDao.class);
ITestScopeDao ts2 = bf.getBean("testScopeDaoImpl",ITestScopeDao.class);
System.out.println(ts1.hashCode()+"----"+ts2.hashCode());
其他使用不多,不甚解