Languages
[Edit]
EN

Spring Boot 2.x - transaction with controller request

5 points
Created by:
Joshua-Heath
685

In this short article, we would like to show how to add transaction to controller request in Spring Boot in Java.

Quick solution: add @Transactional annottation to selected controller method.

 

Practical example

Edit

In below example operations are rolled back on any exceptions that occured in the method.

See also

Edit
  1. Spring Boot 2.x - commit and rollback transaction manually 
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join