amirsnw / Spring-Transaction-Propagation-Examples

Transaction propagation example using Spring Boot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spring Transaction Propagations examples

How is it used in example

  • PersonService.java has different methods defined with propagations levels as NEVER, NOT_SUPPORTED, SUPPORTED, MANDATORY, REQUIRED, REQUIRES_NEW and NESTED.
  • PersonService.java has one non-transactional method 'callTransactionalMethodsWithoutTrasaction()' calling all propagation methods to test the behavior when transaction is not present.
  • PersonService.java has one transactional method 'callTransactionalMethodsWithTrasaction()' calling all propagation methods to test behavior when transaction is present.

Importing and running project

  1. Import project as Maven project
  2. Run application as Spring Boot Application
  3. SpringTransactionPropagationExamplesApplication.java gets the PersonService bean and calls callTransactionalMethodsWithoutTrasaction() and callTransactionalMethodsWithTrasaction()
  4. Observe log and relate it with PersonService logging statements.

About

Transaction propagation example using Spring Boot


Languages

Language:Java 100.0%