Spring以注解方式配置事物

Spring以注解方式配置事物:

@Transactional(isolation=Isolation.REPEATABLE_READ,propagation=Propagation.REQUIRED,readOnly=true)//类上配置的注解会对所有方法生效

public class AccountServiceImpl implements AccountService {

private AccountDao ad ;

private TransactionTemplate tt;

@Override

@Transactional(isolation=Isolation.REPEATABLE_READ,propagation=Propagation.REQUIRED,readOnly=false)//可以覆盖类上配置的注解

public void transfer(final Integer from,final Integer to,final Double money) {

}

}

猜你喜欢

转载自blog.csdn.net/u011266694/article/details/78918532