|
@@ -16,9 +16,11 @@ public class AppTest {
|
|
|
// ClassPathXmlApplicationContext 是一个ApplicationContext的实现,用于从Classpath中的xml获取应用配置
|
|
|
ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
|
|
|
// 获取Bean
|
|
|
- BookDao bookDao = (BookDao) ctx.getBean("bookDao");
|
|
|
- List<Book> bookList = bookDao.getBooks();
|
|
|
- BookService bookService = (BookService) ctx.getBean("bookService");
|
|
|
- List<Book> bookList1 = bookService.listBook();
|
|
|
+// BookDao bookDao = (BookDao) ctx.getBean("bookDao");
|
|
|
+// List<Book> bookList = bookDao.getBooks();
|
|
|
+// BookService bookService = (BookService) ctx.getBean("bookService");
|
|
|
+// List<Book> bookList1 = bookService.listBook();
|
|
|
+ BookService bookService1 = (BookService) ctx.getBean("bookService");
|
|
|
+ bookService1.listBook();
|
|
|
}
|
|
|
}
|