1. Spring使用ClassPathXmlApplicationContext 从classpath读取
ClassPathXmlApplicationContext 默认会去 classPath 路径下找。classPath 路径指的就是编译后的 classes 目录。
1.1 如果配置文件在classpath目录下:
ClassPathXmlApplicationContext tx = new ClassPathXmlApplicationContext("appContext2.xml");
1.2 如果一个包专门用来存配置文件
ClassPathXmlApplicationContext tx = new ClassPathXml
ClassPathXmlApplicationContext 默认会去 classPath 路径下找。classPath 路径指的就是编译后的 classes 目录。
1.1 如果配置文件在classpath目录下:
ClassPathXmlApplicationContext tx = new ClassPathXmlApplicationContext("appContext2.xml");
1.2 如果一个包专门用来存配置文件
ClassPathXmlApplicationContext tx = new ClassPathXml