@Transactional 的默认传播行为
Default propagation beahaviour for @Transactional
我有以下代码:
@Component
public class A{
@Transactional
public void classa(){
//logic
}
}
我没有为 @Transactional
注释指定任何传播行为。所以我想知道 spring 中 @Transactional
的默认传播行为是什么?
REQUIRED是默认传播
REQUIRED
public static final Propagation REQUIRED
Support a current transaction, create a new one if none exists. Analogous to EJB transaction attribute of the same name.
This is the default setting of a transaction annotation.
我有以下代码:
@Component
public class A{
@Transactional
public void classa(){
//logic
}
}
我没有为 @Transactional
注释指定任何传播行为。所以我想知道 spring 中 @Transactional
的默认传播行为是什么?
REQUIRED是默认传播
REQUIRED public static final Propagation REQUIRED Support a current transaction, create a new one if none exists. Analogous to EJB transaction attribute of the same name. This is the default setting of a transaction annotation.