单纯使用Spring进行项目配置(不含Hibernate.Struts)
package com.hz.dao;import org.springframework.context.ApplicationContext;import org.springframework.context.support.FileSystemXmlApplicationContext;import com.hz.service.EmployeeService;public class Test {public static void main(String[] args) {//1. 加载配置文件, 获取Spring容器ApplicationContext ac = new FileSystemXmlApplicationContext("src/applicationContext.xml");EmployeeService es = (EmployeeService) ac.getBean("EmployeeService");Employee emp = new Employee();emp.setEmpno("3");emp.setEname("Tom");es.addEmployee(emp);}}
?
需要引入包? spring.jar?? commons-logging.jar?? Oracle驱动