1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-06-16 18:10:13 +08:00

20 Commits

Author SHA1 Message Date
lcan520
1b64d2a48c Fix [Spring 事务总结] spring-transaction.md 中Propagation 写法错误 2022-04-12 09:31:32 +08:00
guide
84ae035493 [docs update]spring事务内容完善 2022-03-13 10:06:18 +08:00
Mingron
3ac727a98a
Update spring-transaction.md 2022-03-10 22:52:53 +08:00
Mingron
5a44269f13
spring 事务 PROPAGATION_NESTED纠错
ROPAGATION_NESTED:如果当前存在事务,就在嵌套事务内执行;如果当前没有事务,就执行与PROPAGATION_REQUIRED类似的操作,子事务回滚外部主事务也会受到影响进行回滚



``` 
@service
public class UserInvokeService {
    @Autowired
    private UserService userService;
    @resource
    private UserMapper userMapper;

    @transactional
    public void invokeUserService() {
        User user = new User();
        user.setName("zxx");
        user.setAge(333333);
        userMapper.insert(user);
        userService.insertData();

    }
}


@service
public class UserService {

    @resource
    private UserMapper userMapper;


    @transactional(propagation = Propagation.NESTED)
    public void insertData() {
        User user = new User();
        user.setName("inserByNested");
        user.setAge(2222);
        userMapper.insert(user);
        int a = 1 / 0;
    }

}


@SpringBootTest
public class TransactionalTest {
    @Autowired
    UserService userService;
    @Autowired
    UserInvokeService userInvokeService;
    @test
    public void testTransaction() {
        userInvokeService.invokeUserService();
    }
}
```
2022-03-10 22:44:23 +08:00
guide
5a5f8ccb3b [docs feat]vuepress主题更新 2022-03-03 09:14:56 +08:00
yueyang
6d06381bc9
修复错别字
加锁度 -> 加锁读
2022-02-18 15:47:13 +08:00
guide
0af9b3a45c Update spring-transaction.md 2021-12-28 15:58:52 +08:00
guide
63244b8c80 Update spring-transaction.md 2021-12-28 15:52:00 +08:00
guide
6d9b99e48f [docs update]规范Spring相关文件名 2021-12-13 17:36:52 +08:00
guide
5f920adf4f 部分文章重命名 2020-10-17 16:54:25 +08:00
guide
42719e0426 图片修复 2020-10-17 15:21:43 +08:00
ipofss
5894d85a5b
Update spring-transaction.md 2020-08-18 17:12:12 +08:00
SnailClimb
9aa090d7d2
Merge pull request #888 from LiWenGu/hotfix/884
fix884
2020-08-14 21:59:15 +08:00
liwenguang
f9b75ee524 fix884 2020-08-10 11:20:12 +08:00
guide
b4552a6436 [refractor]图片迁移 2020-08-02 17:30:47 +08:00
liwenguang
e0c0abb583 fix843 2020-07-04 16:08:39 +08:00
shuang.kou
16c6e1ef9f Update spring-transaction.md 2020-05-12 15:48:07 +08:00
shuang.kou
1c137c86fd Update spring-transaction.md 2020-05-12 11:20:58 +08:00
shuang.kou
da239bd8de Update spring-transaction.md 2020-04-27 17:59:51 +08:00
shuang.kou
24f210ca61 [feat] update 手把手教你定位常见Java性能问题 2020-04-26 20:41:19 +08:00