@Transactional(propagation = Propagation.REQUIRED) If you don't write properties, this is the default
Dissemination behavior | significance |
---|---|
PROPAGATION_REQUIRES | Indicates that the current method must be run in a transaction. If an existing transaction is in progress, the method will run in that transaction, otherwise a new transaction will be started. |
PROPAGATION_REQUIRES_NEW | Indicates that the current method must be run in its own transaction. A new transaction will be started, and if there is an existing transaction running, it will be suspended while the method is running. |
PROPAGATION_MANDATORY | Indicates that the method must be run in a transaction. If no transaction is currently taking place, an exception will be thrown |
PROPAGATION_NESTED | Indicates that if a transaction is currently in progress, the method should be run in a nested transaction. The nested transaction can be committed or rolled back independently of the encapsulated transaction. If the package transaction does not exist, the behavior is like PROPAGATION_REQUIRES. He will commit together with the parent transaction. When it rolls back, the parent transaction conditionally chooses whether to follow the rollback or continue execution |
PROPAGATION_NEVER | Indicates that the current method should not be run in a transaction. If a transaction is in progress, an exception will be thrown. |
PROPAGATION_NOT_SUPPORTED | Indicates that the method should not be run in a transaction. If an existing transaction is in progress, it will be suspended during the running of the method. |
PROPAGATION_SUPPORTS | Indicates that the current method does not require transactional context, but if a transaction is already running, it can also run in this transaction. |