How can you enable transaction management in a Spring Boot application?

  • By annotating methods or classes with @Transactional.
  • By configuring transactions in the application.properties file.
  • By using the @EnableTransactionManagement annotation.
  • Spring Boot enables transaction management by default.
You can enable transaction management in a Spring Boot application by using the @EnableTransactionManagement annotation. This annotation tells Spring to enable transactional behavior for annotated methods. While you can also annotate methods or classes with @Transactional to specify transactional behavior, you need to enable transaction management globally with @EnableTransactionManagement. Spring Boot does not enable transaction management by default, and configuring transactions in application.properties is not a common approach for enabling transaction management.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *