Nested @Transactional

前端 未结 1 1697
一个人的身影
一个人的身影 2021-01-01 14:26

Is it possible to nest @Transactional annotated methods in spring? Consider something like this:

@Transactional
public void a() {
    obj.b();
}

@Transactio         


        
相关标签:
1条回答
  • 2021-01-01 14:46

    The second @Transactional annotation on method b() is not required because by default @Transactional has a propagation of REQUIRED, therefore methods called by method a() will be transactional. If you are looking to start a new transaction within a method called by method a() you will need to modify the propagation rules. Read about Transaction Propagation.

    0 讨论(0)
提交回复
热议问题