Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Spring for the Architecturally Curious Developer

Spring for the Architecturally Curious Developer

Oliver Drotbohm

November 09, 2022
Tweet

More Decks by Oliver Drotbohm

Other Decks in Programming

Transcript

  1. SPRING
    FOR
    ARCHITECTURALLY
    CURIOUS
    DEVELOPERS
    Oliver Drotbohm [email protected]
    / odrotbohm

    View full-size slide

  2. Coming in 2023…
    Follow @mawspring on

    View full-size slide

  3. Orders
    Inventory
    Order
    Line items
    Stock
    Inventory items

    View full-size slide

  4. Unfortunately, Post-its
    don't run in production…

    View full-size slide

  5. Unfortunately, Post-its
    don't run in production…
    … except you work at Miro.

    View full-size slide

  6. Awesome! !
    Now… what? "

    View full-size slide

  7. Let's get started…
    src/main/java
    ….acme.myproject
    ….acme.myproject.domain
    ….acme.myproject.persistence
    ….acme.myproject.service
    ….acme.myproject.web

    View full-size slide

  8. Let's get started…
    src/main/java
    ….acme.myproject
    ….acme.myproject.domain
    ….acme.myproject.persistence
    ….acme.myproject.service
    ….acme.myproject.web
    #$

    View full-size slide

  9. via https://devopedia.org/cohesion-vs-coupling

    View full-size slide

  10. Domain
    Based
    Structure
    Domain
    Based
    Boundaries
    via Dan North – CUPID—for joyful coding
    Video cast episode @ Software Architektur im Stream (english)

    View full-size slide

  11. src/main/java
    ….acme.myproject
    ….acme.myproject.customer
    ….acme.myproject.inventory
    ….acme.myproject.order
    Much better…
    %!

    View full-size slide

  12. via https://devopedia.org/cohesion-vs-coupling

    View full-size slide

  13. Web
    Business logic
    Data access
    @Repository
    Order Inventory …
    @Controller
    @Service
    Verification? Testing? Documentation? Observation?

    View full-size slide

  14. Sample code
    https://github.com/odrotbohm/arch-evident-spring

    View full-size slide

  15. Demo time! &!

    View full-size slide

  16. Error Scenarios
    Transactional
    Event Listeners

    View full-size slide

  17. @EventListener
    @EventListener

    @TransactionalEventListener
    @TransactionalEventListener

    @Transactional Event
    Event
    Commit
    Consistency boundary
    Spring bean
    Legend

    View full-size slide

  18. Error scenarios

    View full-size slide

  19. What if a transactional
    event listener fails?
    "

    View full-size slide

  20. @EventListener
    @EventListener

    @TransactionalEventListener
    @TransactionalEventListener

    @Transactional Event
    Event
    Commit
    Consistency boundary
    Spring bean
    Legend
    Publication
    lost!
    )
    '(

    View full-size slide

  21. Event Publication
    Registry

    View full-size slide

  22. @TransactionalEventListener
    @TransactionalEventListener

    Event
    @TransactionalEventListener

    @TransactionalEventListener

    Transaction Commit

    View full-size slide

  23. Demo time! &!

    View full-size slide

  24. Spring Modulith
    A convention to map modules to packages
    Simple set of access rules and API to verify
    Test support to bootstrap modules
    Documentation support
    Observability support

    View full-size slide

  25. Thank you!
    Questions?
    Oliver Drotbohm [email protected]
    odrotbohm
    Sample Code

    View full-size slide