spring文件最简单的使用
/**
* @param args
*/
private static final CountDownLatch shutdownLatch = new CountDownLatch(1);
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
ApplicationContext context = new ClassPathXmlApplicationContext("conf/spring/Spring_Base.xml");
shutdownLatch.await();
} catch (InterruptedException e) {
}
}
加载的是conf包下面的,conf包在src下的第一层包。Spring_Base.xml文件可以导入其他spring文件比如
<import resource="Spring_Dao.xml" />
<import resource="Spring_Database.xml" />
<import resource="Spring_XNet.xml" />
<import resource="ServerConfig.xml" />
欢迎关注公众号:Java后端技术全栈