junit测试用例extents AbstractTransactionalJUnit38SpringContextTests
为了防止测试用例给数据库造成的持久性的影响,AbstractTransactionalJUnit38SpringContextTests默认对delete和update操作做了自动回滚
修改办法:
若不需要用户此项贴心的服务,也很方便:
在@Test之后加上@Rollback(false) (需要import org.springframework.test.annotation.Rollback;)
就可以取消自动回滚,让junit测试用例真正影响数据库的数据