public class SpringTracelation {
private ApplicationContext ctx=null;
private BookShopDao bookShopDao=null;
private BookShopService bookShopService=null;
{
ctx=new ClassPathXmlApplicationContext("applicationContext.xml");
bookShopDao=(BookShopDao) ctx.getBean("bookShopDao");
bookShopService=(BookShopService) ctx.getBean("bookShopService");
}
@Test
public void testBookShopService()
{
bookShopService.purchase("孔祥伟","1001");
}
public void testupdateUserAccount()
{
bookShopDao.updateUserAccount("孔祥伟",200);
}
public void testupdateBookStock()
{
bookShopDao.updateBookStock("1001");
}
public void testfindBookByIsbn()
{
System.out.println(bookShopDao.findBookByIsbn("1001"));
}
}
spring事务准备
最新推荐文章于 2024-08-05 21:30:43 发布