测试
public class MyTest { ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); @Test public void test(){ BookService bookService = (BookService) context.getBean("bookService"); UserService userService = (UserService) context.getBean("userService"); bookService.save(); userService.save(); } }
运行结果
BaseDao....
UserDao....