@EnableTransactionManagement

Enables Spring's annotation-driven transaction management capability, similar to the support found in Spring's tx:* XML namespace. To be used on @Configuration classes to configure traditional, imperative transaction management or reactive transaction management.

@EnableTransactionManagement required in Spring Boot?

If we're using a Spring Boot project and have a spring-data-* or spring-tx dependencies on the classpath, then transaction management will be enabled by default.

Spring Boot detects spring-jdbc and h2 on the classpath and automatically creates a DataSource and a JdbcTemplate for you. Because this infrastructure is now available and you have no dedicated configuration, a DataSourceTransactionManager is also created for you. This is the component that intercepts the method annotated with @Transactional (for example, the book method on BookingService). The BookingService is detected by classpath scanning.

Showing a Spring transaction in log

Can easily trace transaction behavior by adding the following property to your yml:

logging.level.org.springframework.transaction.interceptor=TRACE

In case of using JpaTransactionManager:

log4j.logger.org.springframework.orm.jpa=TRACE

Or:

logging:
   level:
      org.springframework.orm.jpa: DEBUG
      org.springframework.transaction: DEBUG