public ApplicationContext ac = new ClassPathXmlApplicationContext(new String[] {"mybatis-spring.xml","spring.xml"}); StudentService studentService =(StudentService)ac.getBean("studentService");