public class BidDaoTest extends AbstractAnnotationAwareTransactionalTests
{
private BidDao bidDao;
public void setBidDao(BidDao bidDao) {
this.bidDao = bidDao;
}
public String[] getConfigLocations()
{
String[] configLocations = {"daoContext.xml","applicationContext.xml"};
return configLocations;
}
@Rollback(false)
public void testFindByUser()
{
}
}
单元测试继承AbstractAnnotationAwareTransactionalTests,虽然里面有一个注释熟悉Rollback,但是测试了很多次,发现该属性没有效果,不清楚到底还有什么地方要设置一下,继承了AbstractAnnotationAwareTransactionalTests,所有的测试方法都是会回滚,刚好跟AbstractDependencyInjectionSpringContextTests类相反