推荐使用【ClassPathXmlApplicationContext】作为调试入口。
大体步骤如下:
1, 创建一个spring工程,编写简单测试用例;
BeanFactory beanFactory = new ClassPathXmlApplicationContext("META-INF/bean-context.xml");
Computer computer = beanFactory.getBean("computer", Computer.class);
2,在resources目录下创建META-INF目录,创建bean-context.xml,配置一个简单的bean;
3,找到【ClassPathXmlApplicationContext.java】源码,在如下方法中打断点;
public ClassPathXmlApplicationContext(String configLocation) throws BeansException {
this(new String[] {configLocation}, true, null);
}
4,调试启动程序,即可进入源码调试。



