第一步:创建javaweb项目
第二步:导入必要的IOC包,这儿有五个
“commons-logging.jar”
“spring-beans-3.2.8.RELEASE.jar”
“spring-context-3.2.8.RELEASE.jar”
“spring-core-3.2.8.RELEASE.jar”
“spring-expression-3.2.8.RELEASE.jar”
第三步:导入spring配置文件,我这儿是applicationContext.xml,虽然在这儿没有实际效用,养成习惯
第四步:写测试代码(注意这个就需要导入Junit 4的包)
@Test
public void test() {
//创建Spring容器
String conf = "applicationContext.xml";
ApplicationContext ctx =
new ClassPathXmlApplicationContext(conf);
System.out.println(ctx);
}
第五步:测试结果:org.springframework.context.support.ClassPathXmlApplicationContext……