@Service
@ContextConfiguration(locations = {
"classpath:config/applicationContext.xml"
})
@RunWith(SpringJUnit4ClassRunner.class)
@TransactionConfiguration(transactionManager="transactionManager", defaultRollback=false)
public class UnionCardServiceImpl implements UnionCardService { @Autowired
private UnionMemberMapper unionMemberMapper; @Test
@Transactional(rollbackFor = Exception.class)
public void updateDemo(){
UnionMember member = new UnionMember();
member.setId();
member.setDelStatus();
unionMemberMapper.updateByPrimaryKeySelective(member);
updateForMaop();
} public void updateForMaop(){
//System.out.println(1/0);//测试异常情况
UnionMember member = new UnionMember();
member.setId();
member.setDelStatus();
unionMemberMapper.updateByPrimaryKeySelective(member);
} }