全民讨论,ClassPathXmlApplicationContext获取bean会再次加载所有配置文件
框架:spring mvc+mybatis
使用的方法:ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
在spring中获取通过ClassPathXmlApplicationContext获取bean的时候为什么会把所以配置再加载一遍,如:mybatis的xml配置文件,数据源配置等所有spring需要初始化的都重新加载一遍。
请高手解惑!有否其他解决办法。