Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

CDI and OSGi so happy together! - R Auge

114 views

Published on

OSGi Community Event 2017 Presentation by Ray Augé [Liferay]

CDI is a cornerstone of JavaEE development. The OSGi Alliance's Enterprise Expert Group has undertaken to develop a specification for how CDI should interact with the OSGi framework and service registry. This talk will review the current progress of this specification and try to lightly demonstrate it's utility.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

CDI and OSGi so happy together! - R Auge

  1. 1. CDI and OSGi So happy together! Raymond Augé raymond.auge@liferay.com
  2. 2. Disclaimer Everything in this presentation is subject to change at any time as it consists of in-progress specification work.
  3. 3. CDI - Key Goals Develop a simple and intuitive model for existing CDI developers Simplify OSGi challenges for new adopters Take advantage of CDI’s SPI as much as possible to ensure compatibility Enable the simplest migration path for existing applications
  4. 4. OSGi - Key Goals Provide services (of all service scopes) Optional, greedy/reluctant, static/dynamic, unary/n-ary, ordered service dependencies Integration with Configuration Admin (& factory configurations) Lazy dependency management (no damping!)
  5. 5. CDI Container
  6. 6. CDI Container holds Managed Beans define graphs instances
  7. 7. Managed Beans have a Scope
  8. 8. Scopes define Lifecycle of managed beans
  9. 9. Lifecycle follow edges of business logic resulting in Contexts which hold contextual instances
  10. 10. Scope’s lifecycle is guided by business rules, may include aspects like identity
  11. 11. Interactions defined by which scopes are Active as well as business rules
  12. 12. Injection across scopes requires visibility
  13. 13. Services are available to traditional scopes via synthetic reference bean
  14. 14. @ApplicationScoped beans can provide services
  15. 15. Configuration available for direct injection, to configure references and published services
  16. 16. Dynamism of dependencies affect this whole region of the container as a single component: Application Component
  17. 17. Pseudo @ComponentScoped encapsulates OSGi’s business rules
  18. 18. @ComponentScoped beans form a graph of contextual instances within a context rooted in the @Component bean, identified by name
  19. 19. Controlled visibility allows OSGi’s integration to fully support Dynamic Component Lifecycle
  20. 20. @Reference to a service provided via synthetic bean scoped to the component context
  21. 21. @Component can provide services
  22. 22. Configuration available for direct injection, to configure references and published services
  23. 23. That’s a lot of detail, but... What does it look like?
  24. 24. @Reference a service in a normal bean
  25. 25. Provide a @Service from regular bean
  26. 26. @Configuration @Property @Service
  27. 27. Producer method, @SessionScoped instance, prototype service
  28. 28. Optional @Reference
  29. 29. @Component with @Reference & multi-configuration interests
  30. 30. Factory component providing a service

×