/** * Transactions are automatically rolled back */ @ContextConfiguration("classpath:/config/applicationContext.xml") public class CollegeMapperTest extends AbstractTransactionalTestNGSpringContextTests{ @Resource private CollegeMapper collegeMapper; @Test public void testInsertReject() throws Exception { Reject reject = new Reject(1,null,"XXX"); collegeMapper.insertReject(reject); } } /** * Select the rollback of the transaction */ @ContextConfiguration("classpath:/config/applicationContext.xml") @TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = false) public class CollegeMapperTest extends AbstractTestNGSpringContextTests{ @Resource private CollegeMapper collegeMapper; @Rollback(true) @Test public void testInsertReject() throws Exception { Reject reject = new Reject(1,null,"XXXX"); collegeMapper.insertReject(reject); } }