【原创文章,转载请注明出处】
刚学Spring,配置上就花了不少时间.
首先给Eclipse EE 装了一个Spring IDE
然后下载了Spring framework 3.0.6 http://www.springframework.org/
发现有很多依赖包,又在CSDN上找到了这个,是Spring 3.0.5的所有依赖: http://download.csdn.net/detail/lzgame/3548052, 一共有8个包
好了,现在需要将Spring framework 和这些依赖包添加到工程中,我把它们分别做成了一个User Library,如下图
注意上图中不要勾选System library(added to the boot class path)这一项.否则运行时会报错.稍后再讲.
然后把它们添加到工程中,如下图
添加进去后就可以运行一个简单的程序了(下面是主程序)
publicclassTestBatch{
private static ApplicationContext context;
@SuppressWarnings("unchecked")
publicstaticvoid main(finalString[] args){
context =newClassPathXmlApplicationContext("/META-INF/spring/applicationContext.xml");
try{
@SuppressWarnings("unused")
TestBatch app =newTestBatch();
}catch(Exception ex){
ex.printStackTrace();
}
}
publicvoidTestBatch(){/** Do Something using the context **/}
}