@Transactional annotation in Spring

Spring provides support for both programmatic and declarative transactions .
1 Programmatic Transactions
With programmatic transactions, transaction management code needs to be explicitly written so as to commit when everything is successful and rolling back if anything goes wrong. The transaction management code is tightly bound to the business logic in this case.

2 Declarative Transactions
Declarative transactions separates transaction management code from the business logic. Spring supports declarative transactions using transaction advice (using AOP) via XML configuration in the spring context or with @Transactional annotation.

Implementation of Transactions
To start using @Transactional annotation in a Spring based application, we need to first enable annotations in our Spring application by adding the needed



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sanjay Singh

Sanjay Singh

Java||Spring-Boot|| Micro services Application developer|| INDIA