首页>代码>基于spring转账Demo,基于注解AOP配置>/com.yyc.spring_transfer_anno/src/main/java/com/yyc/service/impl/AccountServiceImpl.java
package com.yyc.service.impl; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.support.TransactionCallback; import org.springframework.transaction.support.TransactionCallbackWithoutResult; import org.springframework.transaction.support.TransactionTemplate; import com.yyc.dao.AccountDao; import com.yyc.service.AccountService; public class AccountServiceImpl implements AccountService { private AccountDao accountDao; public void setAccountDao(AccountDao accountDao) { this.accountDao = accountDao; } @Transactional(propagation=Propagation.REQUIRED,isolation=Isolation.DEFAULT) public void transfer(String payee, String payer, Integer money) { accountDao.payee(payee, money); //模拟转账出错的情况 //int i = 1/0; accountDao.payer(payer, money); } }

rayshao LV5
2020年2月19日
liuwenlong LV20
2019年12月28日
1358849392 LV21
2019年11月15日
upupup LV5
2019年11月1日
xinghenzzz LV2
2019年11月1日
14725h LV1
2019年10月16日
MouYa77 LV10
2019年9月9日
13734993 LV7
2019年8月7日
zchljt LV3
2019年7月16日
intxiaoyuan LV2
2019年7月8日

xueys123 LV13
2023年6月1日
呵呵哈哈哈 LV10
2022年9月8日
1623096142 LV6
2022年6月20日
and123456 LV11
2022年3月16日
admin123456dawad LV1
2021年7月28日
xintengnia LV2
2021年6月7日
最代码-宋家辉 LV61
2021年5月21日
yyy011003 LV2
2021年1月4日
LDZ16888 LV3
2020年9月20日
xjllllllzgj LV3
2020年7月13日