Declarative or Programmatic Transaction in Spring

后端 未结 6 1595
小蘑菇
小蘑菇 2021-02-03 10:27

What type of transaction management strategy we should use in Spring? Declarative or Programmatic? Which one is better and under what situation one should use it? Can you give a

6条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-03 11:06

    There are two types of Transaction management that Spring supports:

    1. Programmatic Transaction Management: Transaction is managed with the help of programming and provides extreme flexibility, but it is difficult to maintain.

    2. Declarative Transaction Management: Transaction management is separated from business code and only annotations or XML based configurations are used to manage the transactions.

提交回复
热议问题