spring 源码笔记1

118 阅读1分钟

程序入口

ApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring-config.xml");

ClassPathXmlApplicationContext

public ClassPathXmlApplicationContext(String configLocation) throws BeansException {
    //configLocation = spring-config.xml
    //配置文件可能有多个
    this(new String[] {configLocation}, true, null);
}
        public ClassPathXmlApplicationContext(
			String[] configLocations, boolean refresh, @Nullable ApplicationContext parent)
			throws BeansException {
		super(parent);
		setConfigLocations(configLocations);
		if (refresh) {
		        
			refresh();
		}
	}