1)//通过调试可以发现,Spring的IOC容器,在装载配置文件的时候,就已经将bean实例化到内存中,要么是以单例,要么是以原型的
//的方式缓存到内存之中。
AbstractApplicationContext applicationContext=new ClassPathXmlApplicationContext("applicationContext.xml");
applicationContext.getBean("publicBean");
applicationContext.getBean("publicBean");
///AbstractApplicationContext applicationContextCopy=new ClassPathXmlApplicationContext("applicationContext.xml");
//要获取bean的时候,是直接到内存中去拿bean的。
//applicationContextCopy.getBean("publicBean");
2)首先Spring在加载完资源文件之后,就已经把bean实例化,并且放在缓存之中。
在AbstractApplicationContext的refresh()方法中,缓存单例的bean。
// Instan