Keep your Data CORRECT: How to use Transactions in Spring Boot

In this tutorial I show you how to use transactions in Spring Boot.
💌 Know when my latest course drops and get exclusive discounts, join the Devtiro mailing list: devtiro.ck.page/498710f3be
🔗 Links
- Source Code: github.com/devtiro/spring-boo...
- Spring Transaction Management Docs: docs.spring.io/spring-framewo...
🍿 Watch Next
‣ Spring Boot for Beginners Course: bit.ly/44c1xZI
‣ Spring Data & Flyway: • Avoid a Database MELTD...
‣ Spring Boot & MongoDB: • Switch to NOSQL, move ...
🚀 *My Free Online Courses*
‣ Spring Boot for Beginners: bit.ly/44c1xZI
⌨️ *My Gear*
‣ Logitech MX Master Mouse: amzn.to/4aDGhOK
‣ Keychron K3 Keyboard: amzn.to/445FjIF
‣ Sony Alpha 6400: amzn.to/4dkl8uX
‣ Sigma 16mm F1.4 Lens: amzn.to/4d7vQEF
‣ RØDE PodMic: amzn.to/3JN4ruB
📚 Recommended Books for Devs
‣ Clean Code (A must read!) - amzn.to/3UrGA9G
‣ The Phoenix Project - amzn.to/3UsiCtZ
‣ Head First Java - amzn.to/3w3D8ZA
🤔 Who Am I
I'm Aaron Bourne, a KZreadr and Software Developer working and living in the UK. I make videos that share the skills I've built from developing software commercially for almost 15 years. I hope to make software development accessible for everyone and help to make our software better.
Timestamps
0:00 Intro & Theory
3:21 Project Dependencies
4:17 Domain Overview
5:46 Database Overview
7:12 Persistence Layer
7:48 Service Layer
10:38 Presentation Layer
11:11 Start the App
11:45 Test App Without Transactions
15:35 Enable Transactions
16:53 Test App With Transactions
18:44 Next Up
Full disclosure, some of the links in this description are affiliate links that I get a commission from.

Пікірлер: 21

  • @divinity5250
    @divinity5250Ай бұрын

    Your new subscriber ❤🎉

  • @bmamatkdyr
    @bmamatkdyr Жыл бұрын

    That's very helpful, I like your videos 🔥

  • @Vinicius-jn1pt
    @Vinicius-jn1pt5 ай бұрын

    Thanks man. Pretty nice content!

  • @asterixcode
    @asterixcode Жыл бұрын

    Thanks for bringing great and simple examples to things sometimes kinda "obscure" like @Transactions!

  • @ZainAli-go3hl
    @ZainAli-go3hl21 күн бұрын

    learn a lot thanks for the explanation. I have subscribed and hit the like button

  • @ayeshaasim1530
    @ayeshaasim15303 ай бұрын

    Great Explanation!!

  • @emmanuelU17
    @emmanuelU17 Жыл бұрын

    Top video. Didn’t understand the annotation until this!

  • @devolajide

    @devolajide

    Жыл бұрын

    Same here. I use it but I don't understand it and I have been asked in interview before.

  • @marinosag8808
    @marinosag88082 ай бұрын

    great job. keep the good work !

  • @anthroponymy
    @anthroponymy Жыл бұрын

    better use case and good delivery. thank you for this atomic featured videos. it will change the way we knew about what we already knew. it's great please put this video in to a atomic features playlist.

  • @marcelinoparado
    @marcelinoparadoАй бұрын

    helpful content, thanks

  • @ezhilarasikrishnan5408
    @ezhilarasikrishnan54082 ай бұрын

    great explanation ❤👍👍

  • @volodymyrkulesha7542
    @volodymyrkulesha75425 ай бұрын

    Great explanation, as in your other videos.

  • @nobodyishere8935
    @nobodyishere8935 Жыл бұрын

    may be you can add introduction to the Saga pattern for distributed transactions and how to use it in Spring Boot app ?

  • @alexbrun6863
    @alexbrun6863 Жыл бұрын

    Do i need to add Transaction Manger @Bean in the @Configuration class or is it autowired for us with Mysql / Postgres dependency or something?

  • @devtiro

    @devtiro

    Жыл бұрын

    Thank you so much 🙏

  • @ajs9721

    @ajs9721

    6 ай бұрын

    PlatfformTransactionManager bean is auto configured. So it will work out of the box, But like everything you can override if required.

  • @floriankubiak7313
    @floriankubiak73137 ай бұрын

    Does @validate also make the action atomic? Does it save non-validated requests?

  • @ajs9721

    @ajs9721

    6 ай бұрын

    @Valid and @Validate are JPA annotations, so that is a different use case, and will throw exception at the controller during binding, won't even go to Service layer.

  • @mrbmro3991
    @mrbmro39915 ай бұрын

    All well and good using this in your service layer, but how will this work with clean architecture? The service layer would be replaced by the Domain layer and we all know the domain layer has zero dependencies on any other layer such as the outer spring layers etc. How would implement transactional behaviour using clean architecture and even things like cascade?

  • @mrbmro3991

    @mrbmro3991

    5 ай бұрын

    Maybe a solution is to have the controller call a dumb Service such as PersonService which contains the PersonUseCase. When the client calls PersonService.save() the save() method within the PersonService will have the @Transaction annotation and then the next line of code within PersonService.save() will be personUseCase.execute(). This way we simply delegate to the usecase where the business logic lives and at the same time it is transactional?

Келесі