Unit test Transactional automatic rollback

Use junit unit test cases found success with the following operating, but no new data in the database, view the run log Rolled back transaction for testand found things automatically rolled back by adding @Rollback(value = false)submit to force things.

@Test
@Transactional
// @Rollback(value = false)
public void insert() {
    
    
	String name = "dkangel";
    userMapper.insert(name, "123", "123");
    User u = userMapper.findUserByPhone("123");
    Assert.assertEquals(name, u.getName());
}

Guess you like

Origin blog.csdn.net/Dkangel/article/details/107312433