Multiple choice technology architecture

What are the types of the transaction management Spring supports?

  1. Programmatic transaction management.

  2. Declarative transaction management.

  3. Both 1 and 2

  4. None of the above

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Spring supports two types of transaction management: programmatic (manually managing transactions in code) and declarative (using annotations or XML configuration). Both approaches are valid and commonly used depending on the use case. Programmatic gives fine-grained control; declarative is cleaner and preferred for most cases.

AI explanation

To answer this question, you need to understand the types of transaction management that Spring supports. Let's go through each option to understand why it is correct or incorrect:

Option A) Programmatic transaction management - This option is correct because Spring supports programmatic transaction management. In this approach, the developer explicitly writes code to manage transactions using Spring's transaction management APIs.

Option B) Declarative transaction management - This option is correct because Spring also supports declarative transaction management. In this approach, the developer uses annotations or XML configuration to define the transaction boundaries, and Spring automatically handles the transaction management.

Option C) Both 1 and 2 - This option is correct because Spring supports both programmatic and declarative transaction management.

Option D) None of the above - This option is incorrect because Spring supports both programmatic and declarative transaction management.

The correct answer is C) Both 1 and 2. This option is correct because Spring supports both programmatic and declarative transaction management.