spring文件最简单的使用

来源:互联网 发布:数据科学入门 pdf下载 编辑:程序博客网 时间:2024/06/05 11:37
        /**
 * @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" />

原创粉丝点击