public static void main(String[] args) { ApplicationContext context = new FileSystemXmlApplicationContext("WebRoot/WEB-INF/beans-config.xml"); IStaffDao staffDao = (IStaffDao) context.getBean("staffDao"); Staff staff = staffDao.getStaff("zhuzhu", "zhuzhu"); System.out.println(staff.getRealname()); }