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 Slide

  2. View Slide

  3. Coming in 2023…
    Follow @mawspring on

    View Slide

  4. The Domain

    View Slide

  5. Orders
    Inventory
    Order
    Line items
    Stock
    Inventory items

    View Slide

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

    View Slide

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

    View Slide

  8. View Slide

  9. View Slide

  10. Awesome! !
    Now… what? "

    View Slide

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

    View Slide

  12. View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  19. View Slide

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

    View Slide

  21. Demo time! &!

    View Slide

  22. Error Scenarios
    Transactional
    Event Listeners

    View Slide

  23. @EventListener
    @EventListener

    @TransactionalEventListener
    @TransactionalEventListener

    @Transactional Event
    Event
    Commit
    Consistency boundary
    Spring bean
    Legend

    View Slide

  24. Error scenarios

    View Slide

  25. What if a transactional
    event listener fails?
    "

    View Slide

  26. @EventListener
    @EventListener

    @TransactionalEventListener
    @TransactionalEventListener

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

    View Slide

  27. Event Publication
    Registry

    View Slide

  28. @TransactionalEventListener
    @TransactionalEventListener

    Event
    @TransactionalEventListener

    @TransactionalEventListener

    Transaction Commit

    View Slide

  29. Demo time! &!

    View Slide

  30. 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 Slide

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

    View Slide