dyc87112 / SpringBoot-Learning

《Spring Boot基础教程》,2.x版本持续连载中!点击下方链接直达教程目录!
https://blog.didispace.com/spring-boot-learning-2x/
15.76k stars 4.88k forks source link

chapter3-10:使用单元测试 执行成功也会回滚 #60

Open maoqingcode opened 4 years ago

maoqingcode commented 4 years ago

单元测试会自动回滚 添加@Rollback(false)

@Transactional
    @Rollback(false)
    @Test
    public void test(){
        userRepository.save(new User("AAA", 10));
        userRepository.save(new User("BBB", 20));
        userRepository.save(new User("CCC", 30));
    }