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

Modular webapps using Spring Boot and Across

Modular webapps using Spring Boot and Across

Presentation given at Devoxx 2016 on modularizing a Spring framework based webapplication.

Avatar for Arne Vandamme

Arne Vandamme

November 11, 2016
Tweet

Other Decks in Programming

Transcript

  1. @arnevandamme @beforeach #Devoxx #across A bit of background: starting point

    •Large web projects (monoliths) • lots of Maven modules • Single project with many application deploys
  2. @arnevandamme @beforeach #Devoxx #across A bit of background: starting point

    •Large web projects (monoliths) • lots of Maven modules • Single project with many application deploys •Java & Spring
  3. @arnevandamme @beforeach #Devoxx #across A bit of background: starting point

    •Large web projects (monoliths) • lots of Maven modules • Single project with many application deploys •Java & Spring •Typical layered architecture • data –services – business – controllers
  4. @arnevandamme @beforeach #Devoxx #across A bit of background: starting point

    •Large web projects (monoliths) • lots of Maven modules • Single project with many application deploys •Java & Spring •Typical layered architecture • data –services – business – controllers •Custom shared libraries
  5. @arnevandamme @beforeach #Devoxx #across A bit of background: starting point

    •Large web projects (monoliths) • lots of Maven modules • Single project with many application deploys •Java & Spring •Typical layered architecture • data –services – business – controllers •Custom shared libraries But: no easy way to share functional features.
  6. @arnevandamme @beforeach #Devoxx #across What we wanted… Shifting the architecture

    Application controllers services repositories from horizontal…
  7. @arnevandamme @beforeach #Devoxx #across What we wanted… Shifting the architecture

    Application controllers services repositories Application C S R module C S R module from horizontal… …to vertical slices
  8. @arnevandamme @beforeach #Devoxx #across What we needed… A way to

    define and package these modules: • Pluggable: on or off (not: hot-pluggable!) • Providing full functionality and self installing • Limited configuration overhead vs simple app (productivity!)
  9. @arnevandamme @beforeach #Devoxx #across What we needed… A way to

    define and package these modules: • Pluggable: on or off (not: hot-pluggable!) • Providing full functionality and self installing • Limited configuration overhead vs simple app (productivity!) • Stick to the Spring eco-system
  10. @arnevandamme @beforeach #Devoxx #across What we needed… A way to

    define and package these modules: • Pluggable: on or off (not: hot-pluggable!) • Providing full functionality and self installing • Limited configuration overhead vs simple app (productivity!) • Stick to the Spring eco-system • Be able to migrate legacy applications easily
  11. @arnevandamme @beforeach #Devoxx #across What we needed… A way to

    define and package these modules: • Pluggable: on or off (not: hot-pluggable!) • Providing full functionality and self installing • Limited configuration overhead vs simple app (productivity!) • Stick to the Spring eco-system • Be able to migrate legacy applications easily OSGi?
  12. @arnevandamme @beforeach #Devoxx #across What we needed… A way to

    define and package these modules: • Pluggable: on or off (not: hot-pluggable!) • Providing full functionality and self installing • Limited configuration overhead vs simple app (productivity!) • Stick to the Spring eco-system • Be able to migrate legacy applications easily OSGi? Not a real use case for us + hard to transform legacy
  13. @arnevandamme @beforeach #Devoxx #across Across •Framework to define (and use)

    modules: • Their configuration, services they provide
  14. @arnevandamme @beforeach #Devoxx #across Across •Framework to define (and use)

    modules: • Their configuration, services they provide • The dependencies between modules
  15. @arnevandamme @beforeach #Devoxx #across Across •Framework to define (and use)

    modules: • Their configuration, services they provide • The dependencies between modules • Ways that modules can communicate with each other
  16. @arnevandamme @beforeach #Devoxx #across Across •Framework to define (and use)

    modules: • Their configuration, services they provide • The dependencies between modules • Ways that modules can communicate with each other • How they can install/migrate themselves
  17. @arnevandamme @beforeach #Devoxx #across Across •Framework to define (and use)

    modules: • Their configuration, services they provide • The dependencies between modules • Ways that modules can communicate with each other • How they can install/migrate themselves • How to bundle and load resources
  18. @arnevandamme @beforeach #Devoxx #across Across •Framework to define (and use)

    modules: • Their configuration, services they provide • The dependencies between modules • Ways that modules can communicate with each other • How they can install/migrate themselves • How to bundle and load resources 100% built on top of Spring framework (& nowadays Spring Boot)
  19. @arnevandamme @beforeach #Devoxx #across So how is an Across based

    application different from a standard Spring Boot application?
  20. @arnevandamme @beforeach #Devoxx #across Across: ApplicationContext @SpringBootApplication = 1 ApplicationContext

    ApplicationContext @AcrossApplication = (# modules + 1) ApplicationContext Bean Module 1 Module 2 Module 3
  21. @arnevandamme @beforeach #Devoxx #across Across: bean visibility (autowiring) @SpringBootApplication =

    1 ApplicationContext ApplicationContext @AcrossApplication = (# modules + 1) ApplicationContext Bean Module 1 Module 2 Module 3
  22. @arnevandamme @beforeach #Devoxx #across Across: bean visibility (autowiring) @SpringBootApplication =

    1 ApplicationContext ApplicationContext @AcrossApplication = (# modules + 1) ApplicationContext Bean Module 1 Module 2 Module 3
  23. @arnevandamme @beforeach #Devoxx #across Across: bean visibility (autowiring) @SpringBootApplication =

    1 ApplicationContext ApplicationContext @AcrossApplication = (# modules + 1) ApplicationContext Bean Module 1 Module 2 Module 3
  24. @arnevandamme @beforeach #Devoxx #across Across: exposing beans @SpringBootApplication = 1

    ApplicationContext ApplicationContext Bean @AcrossApplication = (# modules + 1) ApplicationContext Module 1 Module 2 Module 3
  25. @arnevandamme @beforeach #Devoxx #across Across: modules are ordered ApplicationContext Bean

    @AcrossApplication = (# modules + 1) ApplicationContext Module 1 Module 2 Module 3 1 2 3
  26. @arnevandamme @beforeach #Devoxx #across Across: modules are ordered Bootstrapping the

    Across application = creating and starting the ApplicationContext of every module in order
  27. @arnevandamme @beforeach #Devoxx #across Installers Installers are (special) prototype-style beans

    in specific locations • @Installer instead of @Component • By default in installers sub-package • @InstallerMethod for executable methods
  28. @arnevandamme @beforeach #Devoxx #across Installers •Only created and called if

    they need executing •Destroyed after execution •Versioned, tracked and synchronized • requires a SQL database • distributed locking mechanism for simultaneous deploys •Bound to a bootstrap phase
  29. @arnevandamme @beforeach #Devoxx #across Bootstrap phases Module 1 Module 2

    Module 3 1 2 3 BeforeContextBootstrap AfterContextBootstrap
  30. @arnevandamme @beforeach #Devoxx #across Bootstrap phases Module 1 Module 2

    Module 3 1 2 3 BeforeContextBootstrap AfterContextBootstrap BeforeModuleBootstrap AfterModuleBootstrap
  31. @arnevandamme @beforeach #Devoxx #across Bootstrap phases Module 1 Module 2

    Module 3 1 2 3 BeforeContextBootstrap AfterContextBootstrap BeforeModuleBootstrap AfterModuleBootstrap BeforeModuleBootstrap AfterModuleBootstrap BeforeModuleBootstrap AfterModuleBootstrap
  32. @arnevandamme @beforeach #Devoxx #across Across Standard Modules A set of

    pluggable modules, playing well with each other, providing common features for building custom websites. Open source & maintained by the core team.
  33. @arnevandamme @beforeach #Devoxx #across Across Standard Modules DebugWebModule Provides a

    simple web UI exposing information about the Across context. Allows other modules to plug into the UI.
  34. @arnevandamme @beforeach #Devoxx #across Across Standard Modules DebugWebModule Provides a

    simple web UI exposing information about the Across context. Allows other modules to plug into the UI. LoggingModule Sets up common logging features like request logging and comes with debug controllers to control the logging at runtime
  35. @arnevandamme @beforeach #Devoxx #across Across Standard Modules AdminWebModule Provides a

    basic administration UI infrastructure for other modules to plug into. • SpringSecurityModule • Allows extending spring security configuration from modules.
  36. @arnevandamme @beforeach #Devoxx #across Across Standard Modules UserModule Provides a

    User and permissions management domain model. Including the security model and management UI.
  37. @arnevandamme @beforeach #Devoxx #across Across Standard Modules UserModule Provides a

    User and permissions management domain model. Including the security model and management UI. EntityModule Infrastructure to (automatically) build UI for entities managed by Spring Data repositories.
  38. @arnevandamme @beforeach #Devoxx #across More standard modules AcrossHibernateJpaModule SpringSecurityAclModule OAuth2Module

    LdapModule … and a couple more: https://foreach.atlassian.net/wiki/display/AX/Standard+modules
  39. @arnevandamme @beforeach #Devoxx #across What next? http://across.foreach.be Getting started: http://across.foreach.be/primer

    Reference docs: http://across.foreach.be/docs Source: https://bitbucket.org/beforeach/ Questions: StackOverflow: across or @arnevandamme
  40. @arnevandamme @beforeach #Devoxx #across What next? http://across.foreach.be Getting started: http://across.foreach.be/primer

    Reference docs: http://across.foreach.be/docs Source: https://bitbucket.org/beforeach/ Questions: StackOverflow: #across or @arnevandamme Contributors wanted! 