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.

DI Frameworks - hidden pearls

1,512 views

Published on

Dependency Injection is now part of nearly every Java project. But what is the difference between DI and CDI. How to decide what I could use better, what frameworks are available and what are the differences for me as a programmer? What could be an option for the IoT-, Desktop- or Webproject?

In this talk we will get an overview over different frameworks and how they are working. We are not checking the well known big one only, but we are looking at some small sometimes specialized implementations.

Published in: Software
  • Be the first to comment

DI Frameworks - hidden pearls

  1. 1. prepare for… DI - Frameworks ..some hidden pearls
  2. 2. @SvenRuppert has been coding java since 1996 Head of R&D / Fellow reply Germany - Munich 2
  3. 3. @SvenRuppert has been coding java since 1996 3
  4. 4. @SvenRuppert has been coding java since 1996 Projects in the field of: •Automobile-industry •Energy •Finance / Leasing •Space- Satellit- •Government / UN / World-bank Where? •Europe •Asia - from India up to Malaysia 3
  5. 5. 4 Save harbor statement
  6. 6. 4 Save harbor statement The following is intended for information purposes only. I can not be held responsible for the overuse of effects and animations in this presentation. If any person in this room has a medical condition that is triggered by fast moving objects on the screen and/or explosions, he/she should probably better leave now… (I got carried away by the topic.)
  7. 7. 5 The Basics @SvenRuppert targets we want to reach
  8. 8. 5 The Basics @SvenRuppert targets we want to reach divide a system into modules
  9. 9. 5 The Basics @SvenRuppert targets we want to reach divide a system into modules decouple contract and implementations
  10. 10. 5 The Basics @SvenRuppert targets we want to reach divide a system into modules decouple contract and implementations decrease complexity
  11. 11. 5 The Basics @SvenRuppert targets we want to reach divide a system into modules decouple contract and implementations decrease complexity but… lets start with the basics
  12. 12. 6 The Basics @SvenRuppert
  13. 13. 6 The Basics @SvenRuppert public List<Data> execute() { //.... return result; }
  14. 14. 6 The Basics @SvenRuppert public List<Data> execute() { //.... return result; } import java.util.List;
  15. 15. 6 The Basics @SvenRuppert public List<Data> execute() { //.... return result; } import java.util.List; final List<Data> result = new ArrayList<>();
  16. 16. 6 The Basics @SvenRuppert public List<Data> execute() { //.... return result; } import java.util.List; import java.util.ArrayList; final List<Data> result = new ArrayList<>();
  17. 17. 6 The Basics @SvenRuppert public List<Data> execute() { //.... return result; } import java.util.List; import java.util.ArrayList; final List<Data> result = new ArrayList<>(); if we don´t need a method like trimToSize()
  18. 18. 6 The Basics @SvenRuppert public List<Data> execute() { //.... return result; } import java.util.List; import java.util.ArrayList; final List<Data> result = new ArrayList<>(); if we don´t need a method like trimToSize() we want to get rid of the dep. ArrayList
  19. 19. 6 The Basics @SvenRuppert public List<Data> execute() { //.... return result; } import java.util.List; import java.util.ArrayList; final List<Data> result = new ArrayList<>(); if we don´t need a method like trimToSize() we want to get rid of the dep. ArrayList
  20. 20. 7 The Basics @SvenRuppert import java.util.List; import java.util.ArrayList; if we don´t need a method like trimToSize() we want to get rid of the dep. ArrayList this will lead to some questions
  21. 21. 7 The Basics @SvenRuppert import java.util.List; import java.util.ArrayList; if we don´t need a method like trimToSize() we want to get rid of the dep. ArrayList this will lead to some questions what will be the right Implementation?
  22. 22. 7 The Basics @SvenRuppert import java.util.List; import java.util.ArrayList; if we don´t need a method like trimToSize() we want to get rid of the dep. ArrayList this will lead to some questions what will be the right Implementation? what is the right time to decide?
  23. 23. 7 The Basics @SvenRuppert import java.util.List; import java.util.ArrayList; if we don´t need a method like trimToSize() we want to get rid of the dep. ArrayList this will lead to some questions what will be the right Implementation? what is the right time to decide? what is the right freq. to decide?
  24. 24. 8 The Basics @SvenRuppert import java.util.List; import java.util.ArrayList; if we don´t need a method like trimToSize() we want to get rid of the dep. ArrayList this will lead to some questions what will be the right Implementation? what is the right time to decide? what is the right freq. to decide?
  25. 25. 8 The Basics @SvenRuppert what will be the right Implementation?
  26. 26. 9 The Basics @SvenRuppert what will be the right Implementation? with default Java SE
  27. 27. 9 The Basics @SvenRuppert what will be the right Implementation? with default Java SE public class ListFactory {
 
 
 
 
 public static void main(String[] args) {
 
 
 
 }
 }
  28. 28. 9 The Basics @SvenRuppert what will be the right Implementation? with default Java SE public class ListFactory {
 
 
 
 
 public static void main(String[] args) {
 
 
 
 }
 } import java.util.List;
  29. 29. 9 The Basics @SvenRuppert what will be the right Implementation? with default Java SE public class ListFactory {
 
 
 
 
 public static void main(String[] args) {
 
 
 
 }
 } public static List createArrayList() { return new ArrayList(); } import java.util.List;
  30. 30. 9 The Basics @SvenRuppert what will be the right Implementation? with default Java SE public class ListFactory {
 
 
 
 
 public static void main(String[] args) {
 
 
 
 }
 } public static List createArrayList() { return new ArrayList(); } final List arrayList = createArrayList(); import java.util.List;
  31. 31. 9 The Basics @SvenRuppert what will be the right Implementation? with default Java SE public class ListFactory {
 
 
 
 
 public static void main(String[] args) {
 
 
 
 }
 } public static List createArrayList() { return new ArrayList(); } final List arrayList = createArrayList(); import java.util.ArrayList; import java.util.List;
  32. 32. 9 The Basics @SvenRuppert what will be the right Implementation? with default Java SE public class ListFactory {
 
 
 
 
 public static void main(String[] args) {
 
 
 
 }
 } public static List createArrayList() { return new ArrayList(); } public static List createLinkedList() { return new LinkedList(); } final List arrayList = createArrayList(); import java.util.ArrayList; import java.util.List;
  33. 33. 9 The Basics @SvenRuppert what will be the right Implementation? with default Java SE public class ListFactory {
 
 
 
 
 public static void main(String[] args) {
 
 
 
 }
 } public static List createArrayList() { return new ArrayList(); } public static List createLinkedList() { return new LinkedList(); } final List arrayList = createArrayList(); final List linkedList = createLinkedList(); import java.util.ArrayList; import java.util.List;
  34. 34. 9 The Basics @SvenRuppert what will be the right Implementation? with default Java SE public class ListFactory {
 
 
 
 
 public static void main(String[] args) {
 
 
 
 }
 } public static List createArrayList() { return new ArrayList(); } public static List createLinkedList() { return new LinkedList(); } final List arrayList = createArrayList(); final List linkedList = createLinkedList(); import java.util.ArrayList; import java.util.LinkedList; import java.util.List;
  35. 35. 9 The Basics @SvenRuppert what will be the right Implementation? with default Java SE public class ListFactory {
 
 
 
 
 public static void main(String[] args) {
 
 
 
 }
 } public static List createArrayList() { return new ArrayList(); } public static List createLinkedList() { return new LinkedList(); } public static List createList() { return new ArrayList(); } final List arrayList = createArrayList(); final List linkedList = createLinkedList(); import java.util.ArrayList; import java.util.LinkedList; import java.util.List;
  36. 36. 9 The Basics @SvenRuppert what will be the right Implementation? with default Java SE public class ListFactory {
 
 
 
 
 public static void main(String[] args) {
 
 
 
 }
 } public static List createArrayList() { return new ArrayList(); } public static List createLinkedList() { return new LinkedList(); } public static List createList() { return new ArrayList(); } final List arrayList = createArrayList(); final List linkedList = createLinkedList(); final List list = createList(); import java.util.ArrayList; import java.util.LinkedList; import java.util.List;
  37. 37. 9 The Basics @SvenRuppert what will be the right Implementation? with default Java SE public class ListFactory {
 
 
 
 
 public static void main(String[] args) {
 
 
 
 }
 } public static List createArrayList() { return new ArrayList(); } public static List createLinkedList() { return new LinkedList(); } public static List createList() { return new ArrayList(); } final List arrayList = createArrayList(); final List linkedList = createLinkedList(); final List list = createList(); import java.util.ArrayList; import java.util.LinkedList; import java.util.List;
  38. 38. 9 The Basics @SvenRuppert what will be the right Implementation? with default Java SE public class ListFactory {
 
 
 
 
 public static void main(String[] args) {
 
 
 
 }
 } public static List createArrayList() { return new ArrayList(); } public static List createLinkedList() { return new LinkedList(); } public static List createList() { return new ArrayList(); } final List arrayList = createArrayList(); final List linkedList = createLinkedList(); final List list = createList(); import java.util.ArrayList; import java.util.LinkedList; import java.util.List;
  39. 39. 9 The Basics @SvenRuppert what will be the right Implementation? with default Java SE public class ListFactory {
 
 
 
 
 public static void main(String[] args) {
 
 
 
 }
 } public static List createArrayList() { return new ArrayList(); } public static List createLinkedList() { return new LinkedList(); } public static List createList() { return new ArrayList(); } final List arrayList = createArrayList(); final List linkedList = createLinkedList(); final List list = createList(); import java.util.ArrayList; import java.util.LinkedList; import java.util.List;
  40. 40. 9 The Basics @SvenRuppert what will be the right Implementation? with default Java SE public class ListFactory {
 
 
 
 
 public static void main(String[] args) {
 
 
 
 }
 } public static List createArrayList() { return new ArrayList(); } public static List createLinkedList() { return new LinkedList(); } public static List createList() { return new ArrayList(); } final List arrayList = createArrayList(); final List linkedList = createLinkedList(); final List list = createList(); import java.util.ArrayList; import java.util.LinkedList; import java.util.List; What goals we reached?
  41. 41. 10 The Basics @SvenRuppert what will be the right Implementation? with default Java SE public List<Data> execute() { //.... return result; } import java.util.List; import java.util.ArrayList; final List<Data> result = new ArrayList<>(); public List<Data> execute() { //.... return result; } import java.util.List; import org.rapidpm.ListFactory; final List<Data> result = ListFactory.createArrayList();
  42. 42. 10 The Basics @SvenRuppert what will be the right Implementation? with default Java SE public List<Data> execute() { //.... return result; } import java.util.List; import java.util.ArrayList; final List<Data> result = new ArrayList<>(); public List<Data> execute() { //.... return result; } import java.util.List; import org.rapidpm.ListFactory; final List<Data> result = ListFactory.createArrayList();
  43. 43. 10 The Basics @SvenRuppert what will be the right Implementation? with default Java SE public List<Data> execute() { //.... return result; } import java.util.List; import java.util.ArrayList; final List<Data> result = new ArrayList<>(); public List<Data> execute() { //.... return result; } import java.util.List; import org.rapidpm.ListFactory; final List<Data> result = ListFactory.createArrayList();
  44. 44. 10 The Basics @SvenRuppert what will be the right Implementation? with default Java SE public List<Data> execute() { //.... return result; } import java.util.List; import java.util.ArrayList; final List<Data> result = new ArrayList<>(); public List<Data> execute() { //.... return result; } import java.util.List; import org.rapidpm.ListFactory; final List<Data> result = ListFactory.createArrayList();
  45. 45. 10 The Basics @SvenRuppert what will be the right Implementation? with default Java SE public List<Data> execute() { //.... return result; } import java.util.List; import java.util.ArrayList; final List<Data> result = new ArrayList<>(); public List<Data> execute() { //.... return result; } import java.util.List; import org.rapidpm.ListFactory; final List<Data> result = ListFactory.createArrayList();
  46. 46. 10 The Basics @SvenRuppert what will be the right Implementation? with default Java SE public List<Data> execute() { //.... return result; } import java.util.List; import java.util.ArrayList; final List<Data> result = new ArrayList<>(); public List<Data> execute() { //.... return result; } import java.util.List; import org.rapidpm.ListFactory; final List<Data> result = ListFactory.createArrayList();
  47. 47. 11 The Basics @SvenRuppert what is the right time to decide? what is the right freq. to decide? Scopes:
  48. 48. 11 The Basics @SvenRuppert what is the right time to decide? what is the right freq. to decide? Scopes: Application / Singleton
  49. 49. 11 The Basics @SvenRuppert what is the right time to decide? what is the right freq. to decide? Scopes: Application / Singleton Session
  50. 50. 11 The Basics @SvenRuppert what is the right time to decide? what is the right freq. to decide? Scopes: Application / Singleton Session Request
  51. 51. 11 The Basics @SvenRuppert what is the right time to decide? what is the right freq. to decide? Scopes: Application / Singleton Session Request Method
  52. 52. 12 The Basics @SvenRuppert
  53. 53. 12 The Basics @SvenRuppert public interface Service {
 String doWork();
 }
  54. 54. 12 The Basics @SvenRuppert public interface Service {
 String doWork();
 } public static class Service2Inject implements Service {
 public String doWork() {
 return null;
 }
 }
  55. 55. 12 The Basics @SvenRuppert public interface Service {
 String doWork();
 } public static class Service2Inject implements Service {
 public String doWork() {
 return null;
 }
 } public static class BusinessModulA {
 private Service service;
 
 public BusinessModulA(final Service service) {
 this.service = service;
 }
 public void work() {
 service.doWork();
 }
 }
  56. 56. 12 The Basics @SvenRuppert public interface Service {
 String doWork();
 } public static class Service2Inject implements Service {
 public String doWork() {
 return null;
 }
 } public static class BusinessModulA {
 private Service service;
 
 public BusinessModulA(final Service service) {
 this.service = service;
 }
 public void work() {
 service.doWork();
 }
 } constructor
  57. 57. 13 The Basics @SvenRuppert public interface Service {
 String doWork();
 } public static class Service2Inject implements Service {
 public String doWork() {
 return null;
 }
 }
  58. 58. 13 The Basics @SvenRuppert public interface Service {
 String doWork();
 } public static class Service2Inject implements Service {
 public String doWork() {
 return null;
 }
 } public static class BusinessModulB {
 private Service service;
 
 public void setService(final Service service) {
 this.service = service;
 }
 
 public void work() {
 service.doWork();
 }
 }
  59. 59. 13 The Basics @SvenRuppert public interface Service {
 String doWork();
 } public static class Service2Inject implements Service {
 public String doWork() {
 return null;
 }
 } public static class BusinessModulB {
 private Service service;
 
 public void setService(final Service service) {
 this.service = service;
 }
 
 public void work() {
 service.doWork();
 }
 } expl. setter
  60. 60. 14 The Basics @SvenRuppert public interface Service {
 String doWork();
 } public static class Service2Inject implements Service {
 public String doWork() {
 return null;
 }
 }
  61. 61. 14 The Basics @SvenRuppert public interface Service {
 String doWork();
 } public static class Service2Inject implements Service {
 public String doWork() {
 return null;
 }
 } public static class BusinessModulC {
 private Service service;
 
 public void work() {
 service.doWork();
 }
 }
  62. 62. 14 The Basics @SvenRuppert public interface Service {
 String doWork();
 } public static class Service2Inject implements Service {
 public String doWork() {
 return null;
 }
 } public static class BusinessModulC {
 private Service service;
 
 public void work() {
 service.doWork();
 }
 } reflection
  63. 63. 15 The Basics @SvenRuppert BusinessModulA businessModulA 
 = new BusinessModulA(new Service2Inject());
 businessModulA.work();
  64. 64. 15 The Basics @SvenRuppert BusinessModulA businessModulA 
 = new BusinessModulA(new Service2Inject());
 businessModulA.work(); T1: create the instance of the Service
  65. 65. 15 The Basics @SvenRuppert BusinessModulA businessModulA 
 = new BusinessModulA(new Service2Inject());
 businessModulA.work(); T1: create the instance of the Service T2: create the instance of the BusinessModul
  66. 66. 15 The Basics @SvenRuppert BusinessModulA businessModulA 
 = new BusinessModulA(new Service2Inject());
 businessModulA.work(); T1: create the instance of the Service T2: create the instance of the BusinessModul T3: method invoke
  67. 67. 16 The Basics @SvenRuppert final BusinessModulB businessModulB = new BusinessModulB();
 businessModulB.setService(new Service2Inject());
 businessModulB.work();
  68. 68. 16 The Basics @SvenRuppert final BusinessModulB businessModulB = new BusinessModulB();
 businessModulB.setService(new Service2Inject());
 businessModulB.work(); T1: create the instance of the BusinessModul
  69. 69. 16 The Basics @SvenRuppert final BusinessModulB businessModulB = new BusinessModulB();
 businessModulB.setService(new Service2Inject());
 businessModulB.work(); T1: create the instance of the BusinessModul T2: create the instance of the Service
  70. 70. 16 The Basics @SvenRuppert final BusinessModulB businessModulB = new BusinessModulB();
 businessModulB.setService(new Service2Inject());
 businessModulB.work(); T1: create the instance of the BusinessModul T2: create the instance of the Service T3: set the Service
  71. 71. 16 The Basics @SvenRuppert final BusinessModulB businessModulB = new BusinessModulB();
 businessModulB.setService(new Service2Inject());
 businessModulB.work(); T1: create the instance of the BusinessModul T2: create the instance of the Service T3: set the Service T4: invoke method
  72. 72. 17 The Basics @SvenRuppert final BusinessModulC businessModulC = new BusinessModulC();
 try {
 final Field serviceField = BusinessModulC.class
 .getDeclaredField("service");
 serviceField.set(businessModulC, new Service2Inject());
 } catch (NoSuchFieldException | IllegalAccessException e) {
 e.printStackTrace();
 }
 businessModulC.work();
  73. 73. 17 The Basics @SvenRuppert final BusinessModulC businessModulC = new BusinessModulC();
 try {
 final Field serviceField = BusinessModulC.class
 .getDeclaredField("service");
 serviceField.set(businessModulC, new Service2Inject());
 } catch (NoSuchFieldException | IllegalAccessException e) {
 e.printStackTrace();
 }
 businessModulC.work(); T1: create the instance of the BusinessModule
  74. 74. 17 The Basics @SvenRuppert final BusinessModulC businessModulC = new BusinessModulC();
 try {
 final Field serviceField = BusinessModulC.class
 .getDeclaredField("service");
 serviceField.set(businessModulC, new Service2Inject());
 } catch (NoSuchFieldException | IllegalAccessException e) {
 e.printStackTrace();
 }
 businessModulC.work(); T1: create the instance of the BusinessModule T2: create the instance of the Service
  75. 75. 17 The Basics @SvenRuppert final BusinessModulC businessModulC = new BusinessModulC();
 try {
 final Field serviceField = BusinessModulC.class
 .getDeclaredField("service");
 serviceField.set(businessModulC, new Service2Inject());
 } catch (NoSuchFieldException | IllegalAccessException e) {
 e.printStackTrace();
 }
 businessModulC.work(); T1: create the instance of the BusinessModule T2: create the instance of the Service T3: set the Service
  76. 76. 17 The Basics @SvenRuppert final BusinessModulC businessModulC = new BusinessModulC();
 try {
 final Field serviceField = BusinessModulC.class
 .getDeclaredField("service");
 serviceField.set(businessModulC, new Service2Inject());
 } catch (NoSuchFieldException | IllegalAccessException e) {
 e.printStackTrace();
 }
 businessModulC.work(); T1: create the instance of the BusinessModule T2: create the instance of the Service T3: set the Service T4: invoke method
  77. 77. Dependency Injection 18 @SvenRuppert every framework will have a strategy how to
  78. 78. Dependency Injection 18 @SvenRuppert every framework will have a strategy how to resolve the Implementation
  79. 79. Dependency Injection 18 @SvenRuppert every framework will have a strategy how to resolve the Implementation create/set the instance
  80. 80. Dependency Injection 18 @SvenRuppert every framework will have a strategy how to resolve the Implementation create/set the instance manage the timeline
  81. 81. A short view on WELD-SE - CDI 19 @SvenRuppert website : http://weld.cdi-spec.org/ the following features are available ( SE )
  82. 82. A short view on WELD-SE - CDI 19 @SvenRuppert website : http://weld.cdi-spec.org/ the following features are available ( SE ) @PostConstruct and @PreDestroy lifecycle callbacks
  83. 83. A short view on WELD-SE - CDI 19 @SvenRuppert website : http://weld.cdi-spec.org/ the following features are available ( SE ) @PostConstruct and @PreDestroy lifecycle callbacks Dependency injection with qualifiers and alternatives
  84. 84. A short view on WELD-SE - CDI 19 @SvenRuppert website : http://weld.cdi-spec.org/ the following features are available ( SE ) @PostConstruct and @PreDestroy lifecycle callbacks Dependency injection with qualifiers and alternatives @Application, @Dependent and @Singleton scopes
  85. 85. A short view on WELD-SE - CDI 19 @SvenRuppert website : http://weld.cdi-spec.org/ the following features are available ( SE ) @PostConstruct and @PreDestroy lifecycle callbacks Dependency injection with qualifiers and alternatives @Application, @Dependent and @Singleton scopes Interceptors and decorators
  86. 86. A short view on WELD-SE - CDI 19 @SvenRuppert website : http://weld.cdi-spec.org/ the following features are available ( SE ) @PostConstruct and @PreDestroy lifecycle callbacks Dependency injection with qualifiers and alternatives @Application, @Dependent and @Singleton scopes Interceptors and decorators Stereotypes - combined Qualifier
  87. 87. A short view on WELD-SE - CDI 19 @SvenRuppert website : http://weld.cdi-spec.org/ the following features are available ( SE ) @PostConstruct and @PreDestroy lifecycle callbacks Dependency injection with qualifiers and alternatives @Application, @Dependent and @Singleton scopes Interceptors and decorators Stereotypes - combined Qualifier Events
  88. 88. A short view on WELD-SE - CDI 19 @SvenRuppert website : http://weld.cdi-spec.org/ the following features are available ( SE ) Portable extension support @PostConstruct and @PreDestroy lifecycle callbacks Dependency injection with qualifiers and alternatives @Application, @Dependent and @Singleton scopes Interceptors and decorators Stereotypes - combined Qualifier Events
  89. 89. A short view on WELD-SE - CDI 19 @SvenRuppert website : http://weld.cdi-spec.org/ the following features are available ( SE ) Portable extension support @PostConstruct and @PreDestroy lifecycle callbacks Dependency injection with qualifiers and alternatives @Application, @Dependent and @Singleton scopes Interceptors and decorators Stereotypes - combined Qualifier Events
  90. 90. A short view on WELD-SE - CDI 19 @SvenRuppert website : http://weld.cdi-spec.org/ the following features are available ( SE ) Portable extension support @PostConstruct and @PreDestroy lifecycle callbacks Dependency injection with qualifiers and alternatives @Application, @Dependent and @Singleton scopes Interceptors and decorators Stereotypes - combined Qualifier Events
  91. 91. A short view on WELD-SE - CDI 19 @SvenRuppert website : http://weld.cdi-spec.org/ the following features are available ( SE ) Portable extension support @PostConstruct and @PreDestroy lifecycle callbacks Dependency injection with qualifiers and alternatives @Application, @Dependent and @Singleton scopes Interceptors and decorators Stereotypes - combined Qualifier Events
  92. 92. A short view on WELD-SE - CDI 19 @SvenRuppert website : http://weld.cdi-spec.org/ the following features are available ( SE ) Portable extension support @PostConstruct and @PreDestroy lifecycle callbacks Dependency injection with qualifiers and alternatives @Application, @Dependent and @Singleton scopes Interceptors and decorators Stereotypes - combined Qualifier Events
  93. 93. A short view on WELD-SE - CDI 20 @SvenRuppert
  94. 94. A short view on WELD-SE - CDI 20 @SvenRuppert Dependency injection with qualifiers and alternatives
  95. 95. A short view on WELD-SE - CDI 20 @SvenRuppert Dependency injection with qualifiers and alternatives public interface Service {
 String doWork(String txt);
 }
  96. 96. A short view on WELD-SE - CDI 20 @SvenRuppert Dependency injection with qualifiers and alternatives public interface Service {
 String doWork(String txt);
 } public class ServiceDefault implements Service {
 public String doWork(final String txt) {
 return this.getClass().getSimpleName() + " " + txt;
 }
 }
  97. 97. A short view on WELD-SE - CDI 20 @SvenRuppert Dependency injection with qualifiers and alternatives public interface Service {
 String doWork(String txt);
 } public class ServiceDefault implements Service {
 public String doWork(final String txt) {
 return this.getClass().getSimpleName() + " " + txt;
 }
 } @Inject Service serviceDefault;
  98. 98. A short view on WELD-SE - CDI 20 @SvenRuppert Dependency injection with qualifiers and alternatives public interface Service {
 String doWork(String txt);
 } public class ServiceDefault implements Service {
 public String doWork(final String txt) {
 return this.getClass().getSimpleName() + " " + txt;
 }
 } @Inject Service serviceDefault; OK
  99. 99. A short view on WELD-SE - CDI 20 @SvenRuppert Dependency injection with qualifiers and alternatives public interface Service {
 String doWork(String txt);
 } public class ServiceDefault implements Service {
 public String doWork(final String txt) {
 return this.getClass().getSimpleName() + " " + txt;
 }
 } @Inject Service serviceDefault; public class Service_A implements Service {
 @Override
 public String doWork(String txt) {
 return this.getClass().getSimpleName() + " " + txt;
 }
 } OK
  100. 100. A short view on WELD-SE - CDI 20 @SvenRuppert Dependency injection with qualifiers and alternatives public interface Service {
 String doWork(String txt);
 } public class ServiceDefault implements Service {
 public String doWork(final String txt) {
 return this.getClass().getSimpleName() + " " + txt;
 }
 } @Inject Service serviceDefault; public class Service_A implements Service {
 @Override
 public String doWork(String txt) {
 return this.getClass().getSimpleName() + " " + txt;
 }
 } WELD-001409: Ambiguous dependencies
  101. 101. A short view on WELD-SE - CDI 20 @SvenRuppert Dependency injection with qualifiers and alternatives public interface Service {
 String doWork(String txt);
 } public class ServiceDefault implements Service {
 public String doWork(final String txt) {
 return this.getClass().getSimpleName() + " " + txt;
 }
 } @Inject Service serviceDefault; public class Service_A implements Service {
 @Override
 public String doWork(String txt) {
 return this.getClass().getSimpleName() + " " + txt;
 }
 } @Prod WELD-001409: Ambiguous dependencies
  102. 102. A short view on WELD-SE - CDI 20 @SvenRuppert Dependency injection with qualifiers and alternatives public interface Service {
 String doWork(String txt);
 } public class ServiceDefault implements Service {
 public String doWork(final String txt) {
 return this.getClass().getSimpleName() + " " + txt;
 }
 } @Inject Service serviceDefault; public class Service_A implements Service {
 @Override
 public String doWork(String txt) {
 return this.getClass().getSimpleName() + " " + txt;
 }
 } @Prod OK
  103. 103. A short view on WELD-SE - CDI 20 @SvenRuppert Dependency injection with qualifiers and alternatives public interface Service {
 String doWork(String txt);
 } public class ServiceDefault implements Service {
 public String doWork(final String txt) {
 return this.getClass().getSimpleName() + " " + txt;
 }
 } @Inject Service serviceDefault; public class Service_A implements Service {
 @Override
 public String doWork(String txt) {
 return this.getClass().getSimpleName() + " " + txt;
 }
 } @Prod @Inject @Prod Service serviceProd; OK
  104. 104. A short view on WELD-SE - CDI 20 @SvenRuppert Dependency injection with qualifiers and alternatives public interface Service {
 String doWork(String txt);
 } public class ServiceDefault implements Service {
 public String doWork(final String txt) {
 return this.getClass().getSimpleName() + " " + txt;
 }
 } @Inject Service serviceDefault; public class Service_A implements Service {
 @Override
 public String doWork(String txt) {
 return this.getClass().getSimpleName() + " " + txt;
 }
 } @Prod @Inject @Prod Service serviceProd; OK
  105. 105. A short view on WELD-SE - CDI 21 @SvenRuppert Dependency injection with qualifiers and alternatives public interface Service {
 String doWork(String txt);
 }
  106. 106. A short view on WELD-SE - CDI 21 @SvenRuppert Dependency injection with qualifiers and alternatives public interface Service {
 String doWork(String txt);
 } public static class ServiceProducer{
 @Produces @WithProducer
 public Service create(){
 return txt -> Service.class.getSimpleName() + " " + txt;
 }
 }
  107. 107. A short view on WELD-SE - CDI 21 @SvenRuppert Dependency injection with qualifiers and alternatives public interface Service {
 String doWork(String txt);
 } public static class ServiceProducer{
 @Produces @WithProducer
 public Service create(){
 return txt -> Service.class.getSimpleName() + " " + txt;
 }
 } @Inject @WithProducer Service serviceProd;
  108. 108. A short view on WELD-SE - CDI 21 @SvenRuppert Dependency injection with qualifiers and alternatives public interface Service {
 String doWork(String txt);
 } public static class ServiceProducer{
 @Produces @WithProducer
 public Service create(){
 return txt -> Service.class.getSimpleName() + " " + txt;
 }
 } @Inject @WithProducer Service serviceProd;
  109. 109. A short view on WELD-SE - CDI 21 @SvenRuppert Dependency injection with qualifiers and alternatives public interface Service {
 String doWork(String txt);
 } public static class ServiceProducer{
 @Produces @WithProducer
 public Service create(){
 return txt -> Service.class.getSimpleName() + " " + txt;
 }
 } @Inject @WithProducer Service serviceProd;
  110. 110. A short view on WELD-SE - CDI 22 @SvenRuppert Dependency injection with qualifiers and alternatives public interface Service {
 String doWork(String txt);
 }
  111. 111. A short view on WELD-SE - CDI 22 @SvenRuppert Dependency injection with qualifiers and alternatives public interface Service {
 String doWork(String txt);
 } @Alternative
 public class ServiceAlternative implements Service {
 @Override
 public String doWork(String txt) {
 return this.getClass().getSimpleName() + " " + txt;
 }
 }
  112. 112. A short view on WELD-SE - CDI 22 @SvenRuppert Dependency injection with qualifiers and alternatives public interface Service {
 String doWork(String txt);
 } @Alternative
 public class ServiceAlternative implements Service {
 @Override
 public String doWork(String txt) {
 return this.getClass().getSimpleName() + " " + txt;
 }
 } @Inject Service serviceProd;
  113. 113. A short view on WELD-SE - CDI 22 @SvenRuppert Dependency injection with qualifiers and alternatives public interface Service {
 String doWork(String txt);
 } @Alternative
 public class ServiceAlternative implements Service {
 @Override
 public String doWork(String txt) {
 return this.getClass().getSimpleName() + " " + txt;
 }
 } @Inject Service serviceProd; <beans ... >
 <alternatives>
 <class>org.rapidpm.ServiceAlternative</class>
 </alternatives>
 </beans>
  114. 114. A short view on WELD-SE - CDI 22 @SvenRuppert Dependency injection with qualifiers and alternatives public interface Service {
 String doWork(String txt);
 } @Alternative
 public class ServiceAlternative implements Service {
 @Override
 public String doWork(String txt) {
 return this.getClass().getSimpleName() + " " + txt;
 }
 } @Inject Service serviceProd; <beans ... >
 <alternatives>
 <class>org.rapidpm.ServiceAlternative</class>
 </alternatives>
 </beans>
  115. 115. A short view on WELD-SE - CDI 22 @SvenRuppert Dependency injection with qualifiers and alternatives public interface Service {
 String doWork(String txt);
 } @Alternative
 public class ServiceAlternative implements Service {
 @Override
 public String doWork(String txt) {
 return this.getClass().getSimpleName() + " " + txt;
 }
 } @Inject Service serviceProd; <beans ... >
 <alternatives>
 <class>org.rapidpm.ServiceAlternative</class>
 </alternatives>
 </beans>
  116. 116. A short view on WELD-SE - CDI 23 @SvenRuppert Dependency injection with qualifiers and alternatives
  117. 117. A short view on WELD-SE - CDI 23 @SvenRuppert Dependency injection with qualifiers and alternatives @Inject Service service;
  118. 118. A short view on WELD-SE - CDI 23 @SvenRuppert Dependency injection with qualifiers and alternatives @Inject Service service; Service service = container.select(Service.class).get();
  119. 119. A short view on WELD-SE - CDI 23 @SvenRuppert Dependency injection with qualifiers and alternatives @Inject Service service; Service service = container.select(Service.class).get(); @Inject Instance<Service> serviceDefaultProxy;
  120. 120. A short view on WELD-SE - CDI 23 @SvenRuppert Dependency injection with qualifiers and alternatives @Inject Service service; Service service = container.select(Service.class).get(); @Inject Instance<Service> serviceDefaultProxy; Service serviceDevProxy = container
 .instance()
 .select(Service.class)
 .select(new AnnotationLiteral<DEV>(){})
 .get();
  121. 121. A short view on WELD-SE - CDI 23 @SvenRuppert Dependency injection with qualifiers and alternatives @Inject Service service; @Inject @WithProducer Service serviceProd; Service service = container.select(Service.class).get(); @Inject Instance<Service> serviceDefaultProxy; Service serviceDevProxy = container
 .instance()
 .select(Service.class)
 .select(new AnnotationLiteral<DEV>(){})
 .get();
  122. 122. A short view on WELD-SE - CDI 24 @SvenRuppert programmatically injection
  123. 123. A short view on WELD-SE - CDI 24 @SvenRuppert programmatically injection @Inject Service service;
  124. 124. A short view on WELD-SE - CDI 24 @SvenRuppert programmatically injection @Inject Service service; Service service = container.select(Service.class).get();
  125. 125. A short view on WELD-SE - CDI 24 @SvenRuppert programmatically injection @Inject Service service; Service service = container.select(Service.class).get();
  126. 126. A short view on WELD-SE - CDI 24 @SvenRuppert programmatically injection @Inject Service service; Service service = container.select(Service.class).get();
  127. 127. A short view on WELD-SE - CDI 24 @SvenRuppert programmatically injection @Inject Service service; Service service = container.select(Service.class).get(); public <T> T activateCDI(T t) {
  128. 128. A short view on WELD-SE - CDI 24 @SvenRuppert programmatically injection @Inject Service service; Service service = container.select(Service.class).get(); public <T> T activateCDI(T t) {
  129. 129. A short view on WELD-SE - CDI 24 @SvenRuppert programmatically injection @Inject Service service; Service service = container.select(Service.class).get(); public <T> T activateCDI(T t) { final Class aClass = t.getClass();
  130. 130. A short view on WELD-SE - CDI 24 @SvenRuppert programmatically injection @Inject Service service; Service service = container.select(Service.class).get(); public <T> T activateCDI(T t) { final Class aClass = t.getClass(); final BeanManager beanManager = CDI.current().getBeanManager();
  131. 131. A short view on WELD-SE - CDI 24 @SvenRuppert programmatically injection @Inject Service service; Service service = container.select(Service.class).get(); public <T> T activateCDI(T t) { final Class aClass = t.getClass(); final BeanManager beanManager = CDI.current().getBeanManager(); final AnnotatedType annotationType
 = beanManager.createAnnotatedType(aClass);
  132. 132. A short view on WELD-SE - CDI 24 @SvenRuppert programmatically injection @Inject Service service; Service service = container.select(Service.class).get(); public <T> T activateCDI(T t) { final Class aClass = t.getClass(); final BeanManager beanManager = CDI.current().getBeanManager(); final AnnotatedType annotationType
 = beanManager.createAnnotatedType(aClass); final InjectionTarget injectionTarget
 = beanManager.createInjectionTarget(annotationType);
  133. 133. A short view on WELD-SE - CDI 24 @SvenRuppert programmatically injection @Inject Service service; Service service = container.select(Service.class).get(); public <T> T activateCDI(T t) { final Class aClass = t.getClass(); final BeanManager beanManager = CDI.current().getBeanManager(); final AnnotatedType annotationType
 = beanManager.createAnnotatedType(aClass); final InjectionTarget injectionTarget
 = beanManager.createInjectionTarget(annotationType); final CreationalContext creationalContext
 = beanManager.createCreationalContext(null);

  134. 134. A short view on WELD-SE - CDI 24 @SvenRuppert programmatically injection @Inject Service service; Service service = container.select(Service.class).get(); public <T> T activateCDI(T t) { final Class aClass = t.getClass(); final BeanManager beanManager = CDI.current().getBeanManager(); final AnnotatedType annotationType
 = beanManager.createAnnotatedType(aClass); final InjectionTarget injectionTarget
 = beanManager.createInjectionTarget(annotationType); final CreationalContext creationalContext
 = beanManager.createCreationalContext(null);
 injectionTarget.inject(t, creationalContext);
  135. 135. A short view on WELD-SE - CDI 24 @SvenRuppert programmatically injection @Inject Service service; Service service = container.select(Service.class).get(); public <T> T activateCDI(T t) { final Class aClass = t.getClass(); final BeanManager beanManager = CDI.current().getBeanManager(); final AnnotatedType annotationType
 = beanManager.createAnnotatedType(aClass); final InjectionTarget injectionTarget
 = beanManager.createInjectionTarget(annotationType); final CreationalContext creationalContext
 = beanManager.createCreationalContext(null);
 injectionTarget.inject(t, creationalContext); injectionTarget.postConstruct(t);
  136. 136. A short view on WELD-SE - CDI 24 @SvenRuppert programmatically injection @Inject Service service; Service service = container.select(Service.class).get(); return t;
 } public <T> T activateCDI(T t) { final Class aClass = t.getClass(); final BeanManager beanManager = CDI.current().getBeanManager(); final AnnotatedType annotationType
 = beanManager.createAnnotatedType(aClass); final InjectionTarget injectionTarget
 = beanManager.createInjectionTarget(annotationType); final CreationalContext creationalContext
 = beanManager.createCreationalContext(null);
 injectionTarget.inject(t, creationalContext); injectionTarget.postConstruct(t);
  137. 137. BoonDI - Project bootstrapping 25 @SvenRuppert website : 
 https://github.com/boonproject/boon/wiki/Boon-DI
  138. 138. BoonDI - Project bootstrapping 25 @SvenRuppert <dependency>
 <groupId>io.fastjson</groupId>
 <artifactId>boon</artifactId>
 <version>0.33</version>
 </dependency> website : 
 https://github.com/boonproject/boon/wiki/Boon-DI
  139. 139. BoonDI - Project bootstrapping 25 @SvenRuppert <dependency>
 <groupId>javax.enterprise</groupId>
 <artifactId>cdi-api</artifactId>
 <version>1.2</version>
 </dependency>
 <dependency>
 <groupId>io.fastjson</groupId>
 <artifactId>boon</artifactId>
 <version>0.33</version>
 </dependency> website : 
 https://github.com/boonproject/boon/wiki/Boon-DI
  140. 140. BoonDI - not a replacement for ….. 26 @SvenRuppert website : 
 https://github.com/boonproject/boon/wiki/Boon-DI
  141. 141. BoonDI - not a replacement for ….. 26 @SvenRuppert website : 
 https://github.com/boonproject/boon/wiki/Boon-DI @In (old from Seam)
  142. 142. BoonDI - not a replacement for ….. 26 @SvenRuppert website : 
 https://github.com/boonproject/boon/wiki/Boon-DI @PostConstruct @In (old from Seam)
  143. 143. BoonDI - not a replacement for ….. 26 @SvenRuppert website : 
 https://github.com/boonproject/boon/wiki/Boon-DI @PostConstruct @In (old from Seam) @Autowired (from Spring)
  144. 144. BoonDI - not a replacement for ….. 26 @SvenRuppert website : 
 https://github.com/boonproject/boon/wiki/Boon-DI @PostConstruct @Inject @In (old from Seam) @Autowired (from Spring)
  145. 145. BoonDI - not a replacement for ….. 26 @SvenRuppert website : 
 https://github.com/boonproject/boon/wiki/Boon-DI @PostConstruct @Inject @Named @In (old from Seam) @Autowired (from Spring)
  146. 146. BoonDI - not a replacement for ….. 26 @SvenRuppert website : 
 https://github.com/boonproject/boon/wiki/Boon-DI @PostConstruct @Inject @Named @In (old from Seam) @Autowired (from Spring) @Required (from Spring)
  147. 147. BoonDI - not a replacement for ….. 26 @SvenRuppert website : 
 https://github.com/boonproject/boon/wiki/Boon-DI @PostConstruct @Inject @Named @In (old from Seam) @Autowired (from Spring) @Required (from Spring) @Qualifier (from Spring)
  148. 148. BoonDI - not a replacement for ….. 26 @SvenRuppert website : 
 https://github.com/boonproject/boon/wiki/Boon-DI @PostConstruct @Inject @Named @In (old from Seam) @Autowired (from Spring) @Required (from Spring) @Qualifier (from Spring) no Scopes
  149. 149. BoonDI - not a replacement for ….. 27 @SvenRuppert website : 
 https://github.com/boonproject/boon/wiki/Boon-DI Boon is not using - AnnotationProcessing - ByteCode - Manipulation
  150. 150. BoonDI - not a replacement for ….. 27 @SvenRuppert website : 
 https://github.com/boonproject/boon/wiki/Boon-DI Boon is not using - AnnotationProcessing - ByteCode - Manipulation OK, this will lead to Reflection or?
  151. 151. 28 BoonDI - Hello World @SvenRuppert
  152. 152. 28 BoonDI - Hello World @SvenRuppert public class Service {
 
 @Inject SubService subService;
 
 @PostConstruct
 public void printInfoPostconstruct() {
 System.out.println("printInfoPostconstruct() "
 + this.getClass().getSimpleName());
 }
 }
  153. 153. 28 BoonDI - Hello World @SvenRuppert public class Service {
 
 @Inject SubService subService;
 
 @PostConstruct
 public void printInfoPostconstruct() {
 System.out.println("printInfoPostconstruct() "
 + this.getClass().getSimpleName());
 }
 } public class SubService {
 @PostConstruct
 public void printInfoPostconstruct() {
 System.out.println("printInfoPostconstruct() "
 + this.getClass().getSimpleName());
 }
 }
  154. 154. 29 BoonDI - Hello World @SvenRuppert
  155. 155. 29 BoonDI - Hello World @SvenRuppert
  156. 156. 29 BoonDI - Hello World @SvenRuppert
  157. 157. 29 BoonDI - Hello World @SvenRuppert
  158. 158. 29 BoonDI - Hello World @SvenRuppert final Module module = DependencyInjection.classes(Service.class);
  159. 159. 29 BoonDI - Hello World @SvenRuppert final Service service1 = module.get(Service.class); final Module module = DependencyInjection.classes(Service.class);
  160. 160. 30 BoonDI - Hello World @SvenRuppert final Service service1 = module.get(Service.class); final Module module = DependencyInjection.classes(Service.class);
  161. 161. 30 BoonDI - Hello World @SvenRuppert final Service service1 = module.get(Service.class); final Module module = DependencyInjection.classes(Service.class); SubService == null
  162. 162. 30 BoonDI - Hello World @SvenRuppert final Service service1 = module.get(Service.class); final Module module = DependencyInjection.classes(Service.class); SubService == null final Module module = DependencyInjection
 .classes(Service.class, SubService.class);
  163. 163. 30 BoonDI - Hello World @SvenRuppert final Service service1 = module.get(Service.class); final Module module = DependencyInjection.classes(Service.class); SubService == null final Module module = DependencyInjection
 .classes(Service.class, SubService.class); final Context context = DependencyInjection.context(module);
  164. 164. 30 BoonDI - Hello World @SvenRuppert final Service service1 = module.get(Service.class); final Module module = DependencyInjection.classes(Service.class); SubService == null final Module module = DependencyInjection
 .classes(Service.class, SubService.class); final Context context = DependencyInjection.context(module); final Service service2 = context.get(Service.class);
  165. 165. 30 BoonDI - Hello World @SvenRuppert final Service service1 = module.get(Service.class); final Module module = DependencyInjection.classes(Service.class); SubService == null SubService != null final Module module = DependencyInjection
 .classes(Service.class, SubService.class); final Context context = DependencyInjection.context(module); final Service service2 = context.get(Service.class);
  166. 166. 30 BoonDI - Hello World @SvenRuppert final Service service1 = module.get(Service.class); final Module module = DependencyInjection.classes(Service.class); SubService == null SubService != null final Module module = DependencyInjection
 .classes(Service.class, SubService.class); final Context context = DependencyInjection.context(module); final Service service2 = context.get(Service.class);
  167. 167. 30 BoonDI - Hello World @SvenRuppert final Service service1 = module.get(Service.class); final Module module = DependencyInjection.classes(Service.class); SubService == null SubService != null final Module module = DependencyInjection
 .classes(Service.class, SubService.class); final Context context = DependencyInjection.context(module); final Service service2 = context.get(Service.class);
  168. 168. 31 BoonDI - Hello World @SvenRuppert final Context context = DependencyInjection.context(module); final Service service2 = context.get(Service.class); final Module module = DependencyInjection
 .classes(Service.class, SubService.class);
  169. 169. 31 BoonDI - Hello World @SvenRuppert final Context context = DependencyInjection.context(module); final Service service2 = context.get(Service.class); public class ServiceModule {
 
 
 } final Module module = DependencyInjection
 .classes(Service.class, SubService.class);
  170. 170. 31 BoonDI - Hello World @SvenRuppert final Context context = DependencyInjection.context(module); final Service service2 = context.get(Service.class); public class ServiceModule {
 
 
 } final Module module = DependencyInjection
 .classes(Service.class, SubService.class); public Service provideService(){ return new Service(); }
  171. 171. 31 BoonDI - Hello World @SvenRuppert final Context context = DependencyInjection.context(module); final Service service2 = context.get(Service.class); public class ServiceModule {
 
 
 } final Module module = DependencyInjection
 .classes(Service.class, SubService.class); public Service provideService(){ return new Service(); } public SubService provideSubService() { return new SubService(); }
  172. 172. 31 BoonDI - Hello World @SvenRuppert final Context context = DependencyInjection.context(module); final Service service2 = context.get(Service.class); public class ServiceModule {
 
 
 } final Module module = DependencyInjection
 .classes(Service.class, SubService.class); final Module module = DependencyInjection
 .module(new ServiceModule()); public Service provideService(){ return new Service(); } public SubService provideSubService() { return new SubService(); }
  173. 173. 31 BoonDI - Hello World @SvenRuppert final Context context = DependencyInjection.context(module); final Service service2 = context.get(Service.class); public class ServiceModule {
 
 
 } final Module module = DependencyInjection
 .classes(Service.class, SubService.class); final Context context = DependencyInjection.context(module); final Module module = DependencyInjection
 .module(new ServiceModule()); public Service provideService(){ return new Service(); } public SubService provideSubService() { return new SubService(); }
  174. 174. 31 BoonDI - Hello World @SvenRuppert final Context context = DependencyInjection.context(module); final Service service2 = context.get(Service.class); public class ServiceModule {
 
 
 } final Module module = DependencyInjection
 .classes(Service.class, SubService.class); final Context context = DependencyInjection.context(module); final Service service2 = context.get(Service.class); final Module module = DependencyInjection
 .module(new ServiceModule()); public Service provideService(){ return new Service(); } public SubService provideSubService() { return new SubService(); }
  175. 175. 32 BoonDI - Hello World @SvenRuppert public class ServiceModule {
 
 
 } final Context context = DependencyInjection.context(module); final Service service2 = context.get(Service.class); final Module module = DependencyInjection
 .module(new ServiceModule()); public Service provideService(){ return new Service(); } public SubService provideSubService() { return new SubService(); }
  176. 176. 32 BoonDI - Hello World @SvenRuppert public class ServiceModule {
 
 
 } final Context context = DependencyInjection.context(module); final Service service2 = context.get(Service.class); final Module module = DependencyInjection
 .module(new ServiceModule()); public Service provideService(){ return new Service(); } public SubService provideSubService() { return new SubService(); }
  177. 177. 32 BoonDI - Hello World @SvenRuppert public class ServiceModule {
 
 
 } final Context context = DependencyInjection.context(module); final Service service2 = context.get(Service.class); final Module module = DependencyInjection
 .module(new ServiceModule()); public Service provideService(){ return new Service(); } public SubService provideSubService() { return new SubService(); }
  178. 178. 32 BoonDI - Hello World @SvenRuppert public class ServiceModule {
 
 
 } final Context context = DependencyInjection.context(module); final Service service2 = context.get(Service.class); final Module module = DependencyInjection
 .module(new ServiceModule()); public Service provideService(){ return new Service(); } public SubService provideSubService() { return new SubService(); } naming conventions
  179. 179. 32 BoonDI - Hello World @SvenRuppert public class ServiceModule {
 
 
 } final Context context = DependencyInjection.context(module); final Service service2 = context.get(Service.class); final Module module = DependencyInjection
 .module(new ServiceModule()); public Service provideService(){ return new Service(); } public SubService provideSubService() { return new SubService(); } naming conventions not refactoring safe
  180. 180. 33 BoonDI - Modules @SvenRuppert at runtime you can addModule() removeModule()
  181. 181. 34 BoonDI - Modules - be careful :-) @SvenRuppert
  182. 182. 34 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA {
  183. 183. 34 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { out.println("provideServiceAA ...");
  184. 184. 34 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { out.println("provideServiceAA ..."); public Service provideServiceB() { out.println("provideServiceAB ...");
  185. 185. 34 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { out.println("provideServiceAA ..."); public Service provideServiceB() { out.println("provideServiceAB ..."); public Service provideServiceC() { out.println("provideServiceAC ...");
  186. 186. 34 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { out.println("provideServiceAA ..."); public Service provideServiceB() { out.println("provideServiceAB ..."); public Service provideServiceC() { out.println("provideServiceAC ..."); public class ServiceModuleB {
  187. 187. 34 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { out.println("provideServiceAA ..."); public Service provideServiceB() { out.println("provideServiceAB ..."); public Service provideServiceC() { out.println("provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { out.println("provideServiceBA ...");
  188. 188. 34 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { out.println("provideServiceAA ..."); public Service provideServiceB() { out.println("provideServiceAB ..."); public Service provideServiceC() { out.println("provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { out.println("provideServiceBA ..."); public Service provideServiceB() { out.println("provideServiceBB ...");
  189. 189. 34 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { out.println("provideServiceAA ..."); public Service provideServiceB() { out.println("provideServiceAB ..."); public Service provideServiceC() { out.println("provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { out.println("provideServiceBA ..."); public Service provideServiceB() { out.println("provideServiceBB ..."); public Service provideServiceC() { out.println("provideServiceBC ...");
  190. 190. 34 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { out.println("provideServiceAA ..."); public Service provideServiceB() { out.println("provideServiceAB ..."); public Service provideServiceC() { out.println("provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { out.println("provideServiceBA ..."); public Service provideServiceB() { out.println("provideServiceBB ..."); public Service provideServiceC() { out.println("provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB());
  191. 191. 34 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { out.println("provideServiceAA ..."); public Service provideServiceB() { out.println("provideServiceAB ..."); public Service provideServiceC() { out.println("provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { out.println("provideServiceBA ..."); public Service provideServiceB() { out.println("provideServiceBB ..."); public Service provideServiceC() { out.println("provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB());
  192. 192. 34 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { out.println("provideServiceAA ..."); public Service provideServiceB() { out.println("provideServiceAB ..."); public Service provideServiceC() { out.println("provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { out.println("provideServiceBA ..."); public Service provideServiceB() { out.println("provideServiceBB ..."); public Service provideServiceC() { out.println("provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB());
  193. 193. 34 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { out.println("provideServiceAA ..."); public Service provideServiceB() { out.println("provideServiceAB ..."); public Service provideServiceC() { out.println("provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { out.println("provideServiceBA ..."); public Service provideServiceB() { out.println("provideServiceBB ..."); public Service provideServiceC() { out.println("provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB());
  194. 194. 34 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { out.println("provideServiceAA ..."); public Service provideServiceB() { out.println("provideServiceAB ..."); public Service provideServiceC() { out.println("provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { out.println("provideServiceBA ..."); public Service provideServiceB() { out.println("provideServiceBB ..."); public Service provideServiceC() { out.println("provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB());
  195. 195. 35 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { "provideServiceAA ..."); public Service provideServiceB() {"provideServiceAB ..."); public Service provideServiceC() {"provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { "provideServiceBA ..."); public Service provideServiceB() { "provideServiceBB ..."); public Service provideServiceC() {"provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB());
  196. 196. 35 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { "provideServiceAA ..."); public Service provideServiceB() {"provideServiceAB ..."); public Service provideServiceC() {"provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { "provideServiceBA ..."); public Service provideServiceB() { "provideServiceBB ..."); public Service provideServiceC() {"provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection.context(moduleA);
  197. 197. 35 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { "provideServiceAA ..."); public Service provideServiceB() {"provideServiceAB ..."); public Service provideServiceC() {"provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { "provideServiceBA ..."); public Service provideServiceB() { "provideServiceBB ..."); public Service provideServiceC() {"provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection.context(moduleA); context.get(Service.class);
  198. 198. 35 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { "provideServiceAA ..."); public Service provideServiceB() {"provideServiceAB ..."); public Service provideServiceC() {"provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { "provideServiceBA ..."); public Service provideServiceB() { "provideServiceBB ..."); public Service provideServiceC() {"provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection.context(moduleA); context.get(Service.class); provideServiceAB
  199. 199. 35 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { "provideServiceAA ..."); public Service provideServiceB() {"provideServiceAB ..."); public Service provideServiceC() {"provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { "provideServiceBA ..."); public Service provideServiceB() { "provideServiceBB ..."); public Service provideServiceC() {"provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection.context(moduleA); context.get(Service.class); provideServiceAB final Context add = context.add(moduleB);
  200. 200. 35 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { "provideServiceAA ..."); public Service provideServiceB() {"provideServiceAB ..."); public Service provideServiceC() {"provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { "provideServiceBA ..."); public Service provideServiceB() { "provideServiceBB ..."); public Service provideServiceC() {"provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection.context(moduleA); context.get(Service.class); provideServiceAB final Context add = context.add(moduleB); context.get(Service.class);
  201. 201. 35 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { "provideServiceAA ..."); public Service provideServiceB() {"provideServiceAB ..."); public Service provideServiceC() {"provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { "provideServiceBA ..."); public Service provideServiceB() { "provideServiceBB ..."); public Service provideServiceC() {"provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection.context(moduleA); context.get(Service.class); provideServiceAB final Context add = context.add(moduleB); context.get(Service.class); provideServiceAB
  202. 202. 35 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { "provideServiceAA ..."); public Service provideServiceB() {"provideServiceAB ..."); public Service provideServiceC() {"provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { "provideServiceBA ..."); public Service provideServiceB() { "provideServiceBB ..."); public Service provideServiceC() {"provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection.context(moduleA); context.get(Service.class); provideServiceAB final Context add = context.add(moduleB); context.get(Service.class); add.get(Service.class); provideServiceAB
  203. 203. 35 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { "provideServiceAA ..."); public Service provideServiceB() {"provideServiceAB ..."); public Service provideServiceC() {"provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { "provideServiceBA ..."); public Service provideServiceB() { "provideServiceBB ..."); public Service provideServiceC() {"provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection.context(moduleA); context.get(Service.class); provideServiceAB final Context add = context.add(moduleB); context.get(Service.class); add.get(Service.class); provideServiceAB provideServiceAB
  204. 204. 35 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { "provideServiceAA ..."); public Service provideServiceB() {"provideServiceAB ..."); public Service provideServiceC() {"provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { "provideServiceBA ..."); public Service provideServiceB() { "provideServiceBB ..."); public Service provideServiceC() {"provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection.context(moduleA); context.get(Service.class); provideServiceAB final Context add = context.add(moduleB); context.get(Service.class); add.get(Service.class); provideServiceAB provideServiceAB final Context context = DependencyInjection.context(moduleA,moduleB);
  205. 205. 35 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { "provideServiceAA ..."); public Service provideServiceB() {"provideServiceAB ..."); public Service provideServiceC() {"provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { "provideServiceBA ..."); public Service provideServiceB() { "provideServiceBB ..."); public Service provideServiceC() {"provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection.context(moduleA); context.get(Service.class); provideServiceAB final Context add = context.add(moduleB); context.get(Service.class); add.get(Service.class); provideServiceAB provideServiceAB final Context context = DependencyInjection.context(moduleA,moduleB); context.get(Service.class);
  206. 206. 35 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { "provideServiceAA ..."); public Service provideServiceB() {"provideServiceAB ..."); public Service provideServiceC() {"provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { "provideServiceBA ..."); public Service provideServiceB() { "provideServiceBB ..."); public Service provideServiceC() {"provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection.context(moduleA); context.get(Service.class); provideServiceAB final Context add = context.add(moduleB); context.get(Service.class); add.get(Service.class); provideServiceAB provideServiceAB final Context context = DependencyInjection.context(moduleA,moduleB); context.get(Service.class); provideServiceAB
  207. 207. 36 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { "provideServiceAA ..."); public Service provideServiceB() {"provideServiceAB ..."); public Service provideServiceC() {"provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { "provideServiceBA ..."); public Service provideServiceB() { "provideServiceBB ..."); public Service provideServiceC() {"provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB());
  208. 208. 36 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { "provideServiceAA ..."); public Service provideServiceB() {"provideServiceAB ..."); public Service provideServiceC() {"provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { "provideServiceBA ..."); public Service provideServiceB() { "provideServiceBB ..."); public Service provideServiceC() {"provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection.context(moduleB);
  209. 209. 36 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { "provideServiceAA ..."); public Service provideServiceB() {"provideServiceAB ..."); public Service provideServiceC() {"provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { "provideServiceBA ..."); public Service provideServiceB() { "provideServiceBB ..."); public Service provideServiceC() {"provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection.context(moduleB); context.get(Service.class);
  210. 210. 36 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { "provideServiceAA ..."); public Service provideServiceB() {"provideServiceAB ..."); public Service provideServiceC() {"provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { "provideServiceBA ..."); public Service provideServiceB() { "provideServiceBB ..."); public Service provideServiceC() {"provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection.context(moduleB); context.get(Service.class); provideServiceBB
  211. 211. 36 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { "provideServiceAA ..."); public Service provideServiceB() {"provideServiceAB ..."); public Service provideServiceC() {"provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { "provideServiceBA ..."); public Service provideServiceB() { "provideServiceBB ..."); public Service provideServiceC() {"provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection.context(moduleB); context.get(Service.class); provideServiceBB final Context add = context.add(moduleA);
  212. 212. 36 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { "provideServiceAA ..."); public Service provideServiceB() {"provideServiceAB ..."); public Service provideServiceC() {"provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { "provideServiceBA ..."); public Service provideServiceB() { "provideServiceBB ..."); public Service provideServiceC() {"provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection.context(moduleB); context.get(Service.class); provideServiceBB final Context add = context.add(moduleA); context.get(Service.class);
  213. 213. 36 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { "provideServiceAA ..."); public Service provideServiceB() {"provideServiceAB ..."); public Service provideServiceC() {"provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { "provideServiceBA ..."); public Service provideServiceB() { "provideServiceBB ..."); public Service provideServiceC() {"provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection.context(moduleB); context.get(Service.class); provideServiceBB final Context add = context.add(moduleA); context.get(Service.class); provideServiceBB
  214. 214. 36 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { "provideServiceAA ..."); public Service provideServiceB() {"provideServiceAB ..."); public Service provideServiceC() {"provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { "provideServiceBA ..."); public Service provideServiceB() { "provideServiceBB ..."); public Service provideServiceC() {"provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection.context(moduleB); context.get(Service.class); provideServiceBB final Context add = context.add(moduleA); context.get(Service.class); add.get(Service.class); provideServiceBB
  215. 215. 36 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { "provideServiceAA ..."); public Service provideServiceB() {"provideServiceAB ..."); public Service provideServiceC() {"provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { "provideServiceBA ..."); public Service provideServiceB() { "provideServiceBB ..."); public Service provideServiceC() {"provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection.context(moduleB); context.get(Service.class); provideServiceBB final Context add = context.add(moduleA); context.get(Service.class); add.get(Service.class); provideServiceBB provideServiceBB
  216. 216. 36 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { "provideServiceAA ..."); public Service provideServiceB() {"provideServiceAB ..."); public Service provideServiceC() {"provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { "provideServiceBA ..."); public Service provideServiceB() { "provideServiceBB ..."); public Service provideServiceC() {"provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection.context(moduleB); context.get(Service.class); provideServiceBB final Context add = context.add(moduleA); context.get(Service.class); add.get(Service.class); provideServiceBB provideServiceBB final Context context = DependencyInjection.context(moduleB,moduleA);
  217. 217. 36 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { "provideServiceAA ..."); public Service provideServiceB() {"provideServiceAB ..."); public Service provideServiceC() {"provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { "provideServiceBA ..."); public Service provideServiceB() { "provideServiceBB ..."); public Service provideServiceC() {"provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection.context(moduleB); context.get(Service.class); provideServiceBB final Context add = context.add(moduleA); context.get(Service.class); add.get(Service.class); provideServiceBB provideServiceBB final Context context = DependencyInjection.context(moduleB,moduleA); context.get(Service.class);
  218. 218. 36 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { "provideServiceAA ..."); public Service provideServiceB() {"provideServiceAB ..."); public Service provideServiceC() {"provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { "provideServiceBA ..."); public Service provideServiceB() { "provideServiceBB ..."); public Service provideServiceC() {"provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection.context(moduleB); context.get(Service.class); provideServiceBB final Context add = context.add(moduleA); context.get(Service.class); add.get(Service.class); provideServiceBB provideServiceBB final Context context = DependencyInjection.context(moduleB,moduleA); context.get(Service.class); provideServiceBB
  219. 219. 36 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceA() { "provideServiceAA ..."); public Service provideServiceB() {"provideServiceAB ..."); public Service provideServiceC() {"provideServiceAC ..."); public class ServiceModuleB { public Service provideServiceA() { "provideServiceBA ..."); public Service provideServiceB() { "provideServiceBB ..."); public Service provideServiceC() {"provideServiceBC ..."); final Module moduleA = DependencyInjection.module(new ServiceModuleA());
 final Module moduleB = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection.context(moduleB); context.get(Service.class); provideServiceBB final Context add = context.add(moduleA); context.get(Service.class); add.get(Service.class); provideServiceBB provideServiceBB final Context context = DependencyInjection.context(moduleB,moduleA); context.get(Service.class); provideServiceBB So far so good…. but what could happen??
  220. 220. 37 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceB() {"provideServiceAB ..."); public class ServiceModuleB { public Service provideServiceB() {"provideServiceBB ...");
  221. 221. 37 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceB() {"provideServiceAB ..."); public class ServiceModuleB { public Service provideServiceB() {"provideServiceBB ..."); final Module moduleA1 = DependencyInjection.module(new ServiceModuleA());
  222. 222. 37 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceB() {"provideServiceAB ..."); public class ServiceModuleB { public Service provideServiceB() {"provideServiceBB ..."); final Module moduleA1 = DependencyInjection.module(new ServiceModuleA()); final Module moduleA2 = DependencyInjection.module(new ServiceModuleA());
  223. 223. 37 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceB() {"provideServiceAB ..."); public class ServiceModuleB { public Service provideServiceB() {"provideServiceBB ..."); final Module moduleA1 = DependencyInjection.module(new ServiceModuleA()); final Module moduleA2 = DependencyInjection.module(new ServiceModuleA()); final Module moduleB1 = DependencyInjection.module(new ServiceModuleB());
  224. 224. 37 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceB() {"provideServiceAB ..."); public class ServiceModuleB { public Service provideServiceB() {"provideServiceBB ..."); final Module moduleA1 = DependencyInjection.module(new ServiceModuleA()); final Module moduleA2 = DependencyInjection.module(new ServiceModuleA()); final Module moduleB1 = DependencyInjection.module(new ServiceModuleB()); final Module moduleB2 = DependencyInjection.module(new ServiceModuleB());
  225. 225. 37 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceB() {"provideServiceAB ..."); public class ServiceModuleB { public Service provideServiceB() {"provideServiceBB ..."); final Module moduleA1 = DependencyInjection.module(new ServiceModuleA()); final Module moduleA2 = DependencyInjection.module(new ServiceModuleA()); final Module moduleB1 = DependencyInjection.module(new ServiceModuleB()); final Module moduleB2 = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection
  226. 226. 37 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceB() {"provideServiceAB ..."); public class ServiceModuleB { public Service provideServiceB() {"provideServiceBB ..."); final Module moduleA1 = DependencyInjection.module(new ServiceModuleA()); final Module moduleA2 = DependencyInjection.module(new ServiceModuleA()); final Module moduleB1 = DependencyInjection.module(new ServiceModuleB()); final Module moduleB2 = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection .context(moduleA1)
  227. 227. 37 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceB() {"provideServiceAB ..."); public class ServiceModuleB { public Service provideServiceB() {"provideServiceBB ..."); final Module moduleA1 = DependencyInjection.module(new ServiceModuleA()); final Module moduleA2 = DependencyInjection.module(new ServiceModuleA()); final Module moduleB1 = DependencyInjection.module(new ServiceModuleB()); final Module moduleB2 = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection .context(moduleA1).context(moduleB1)
  228. 228. 37 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceB() {"provideServiceAB ..."); public class ServiceModuleB { public Service provideServiceB() {"provideServiceBB ..."); final Module moduleA1 = DependencyInjection.module(new ServiceModuleA()); final Module moduleA2 = DependencyInjection.module(new ServiceModuleA()); final Module moduleB1 = DependencyInjection.module(new ServiceModuleB()); final Module moduleB2 = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection .context(moduleA1).context(moduleB1) .context(moduleA2)
  229. 229. 37 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceB() {"provideServiceAB ..."); public class ServiceModuleB { public Service provideServiceB() {"provideServiceBB ..."); final Module moduleA1 = DependencyInjection.module(new ServiceModuleA()); final Module moduleA2 = DependencyInjection.module(new ServiceModuleA()); final Module moduleB1 = DependencyInjection.module(new ServiceModuleB()); final Module moduleB2 = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection .context(moduleA1).context(moduleB1) .context(moduleA2).context(moduleB2);
  230. 230. 37 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceB() {"provideServiceAB ..."); public class ServiceModuleB { public Service provideServiceB() {"provideServiceBB ..."); final Module moduleA1 = DependencyInjection.module(new ServiceModuleA()); final Module moduleA2 = DependencyInjection.module(new ServiceModuleA()); final Module moduleB1 = DependencyInjection.module(new ServiceModuleB()); final Module moduleB2 = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection .context(moduleA1).context(moduleB1) .context(moduleA2).context(moduleB2); context.get(Service.class);
  231. 231. 37 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceB() {"provideServiceAB ..."); public class ServiceModuleB { public Service provideServiceB() {"provideServiceBB ..."); final Module moduleA1 = DependencyInjection.module(new ServiceModuleA()); final Module moduleA2 = DependencyInjection.module(new ServiceModuleA()); final Module moduleB1 = DependencyInjection.module(new ServiceModuleB()); final Module moduleB2 = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection .context(moduleA1).context(moduleB1) .context(moduleA2).context(moduleB2); context.get(Service.class); provideServiceAB
  232. 232. 37 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceB() {"provideServiceAB ..."); public class ServiceModuleB { public Service provideServiceB() {"provideServiceBB ..."); final Module moduleA1 = DependencyInjection.module(new ServiceModuleA()); final Module moduleA2 = DependencyInjection.module(new ServiceModuleA()); final Module moduleB1 = DependencyInjection.module(new ServiceModuleB()); final Module moduleB2 = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection .context(moduleA1).context(moduleB1) .context(moduleA2).context(moduleB2); context.get(Service.class); context.remove(moduleA1); provideServiceAB
  233. 233. 37 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceB() {"provideServiceAB ..."); public class ServiceModuleB { public Service provideServiceB() {"provideServiceBB ..."); final Module moduleA1 = DependencyInjection.module(new ServiceModuleA()); final Module moduleA2 = DependencyInjection.module(new ServiceModuleA()); final Module moduleB1 = DependencyInjection.module(new ServiceModuleB()); final Module moduleB2 = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection .context(moduleA1).context(moduleB1) .context(moduleA2).context(moduleB2); context.get(Service.class); context.remove(moduleA1); context.get(Service.class); provideServiceAB
  234. 234. 37 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceB() {"provideServiceAB ..."); public class ServiceModuleB { public Service provideServiceB() {"provideServiceBB ..."); final Module moduleA1 = DependencyInjection.module(new ServiceModuleA()); final Module moduleA2 = DependencyInjection.module(new ServiceModuleA()); final Module moduleB1 = DependencyInjection.module(new ServiceModuleB()); final Module moduleB2 = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection .context(moduleA1).context(moduleB1) .context(moduleA2).context(moduleB2); context.get(Service.class); context.remove(moduleA1); context.get(Service.class); provideServiceAB provideServiceBB
  235. 235. 37 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceB() {"provideServiceAB ..."); public class ServiceModuleB { public Service provideServiceB() {"provideServiceBB ..."); final Module moduleA1 = DependencyInjection.module(new ServiceModuleA()); final Module moduleA2 = DependencyInjection.module(new ServiceModuleA()); final Module moduleB1 = DependencyInjection.module(new ServiceModuleB()); final Module moduleB2 = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection .context(moduleA1).context(moduleB1) .context(moduleA2).context(moduleB2); context.get(Service.class); context.remove(moduleA1); context.get(Service.class); context.remove(moduleB1); provideServiceAB provideServiceBB
  236. 236. 37 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceB() {"provideServiceAB ..."); public class ServiceModuleB { public Service provideServiceB() {"provideServiceBB ..."); final Module moduleA1 = DependencyInjection.module(new ServiceModuleA()); final Module moduleA2 = DependencyInjection.module(new ServiceModuleA()); final Module moduleB1 = DependencyInjection.module(new ServiceModuleB()); final Module moduleB2 = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection .context(moduleA1).context(moduleB1) .context(moduleA2).context(moduleB2); context.get(Service.class); context.remove(moduleA1); context.get(Service.class); context.remove(moduleB1); context.get(Service.class); provideServiceAB provideServiceBB
  237. 237. 37 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceB() {"provideServiceAB ..."); public class ServiceModuleB { public Service provideServiceB() {"provideServiceBB ..."); final Module moduleA1 = DependencyInjection.module(new ServiceModuleA()); final Module moduleA2 = DependencyInjection.module(new ServiceModuleA()); final Module moduleB1 = DependencyInjection.module(new ServiceModuleB()); final Module moduleB2 = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection .context(moduleA1).context(moduleB1) .context(moduleA2).context(moduleB2); context.get(Service.class); context.remove(moduleA1); context.get(Service.class); context.remove(moduleB1); context.get(Service.class); provideServiceAB provideServiceBB provideServiceAB
  238. 238. 37 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceB() {"provideServiceAB ..."); public class ServiceModuleB { public Service provideServiceB() {"provideServiceBB ..."); final Module moduleA1 = DependencyInjection.module(new ServiceModuleA()); final Module moduleA2 = DependencyInjection.module(new ServiceModuleA()); final Module moduleB1 = DependencyInjection.module(new ServiceModuleB()); final Module moduleB2 = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection .context(moduleA1).context(moduleB1) .context(moduleA2).context(moduleB2); context.get(Service.class); context.remove(moduleA1); context.get(Service.class); context.remove(moduleB1); context.get(Service.class); context.remove(moduleA2); provideServiceAB provideServiceBB provideServiceAB
  239. 239. 37 BoonDI - Modules - be careful :-) @SvenRuppert public class ServiceModuleA { public Service provideServiceB() {"provideServiceAB ..."); public class ServiceModuleB { public Service provideServiceB() {"provideServiceBB ..."); final Module moduleA1 = DependencyInjection.module(new ServiceModuleA()); final Module moduleA2 = DependencyInjection.module(new ServiceModuleA()); final Module moduleB1 = DependencyInjection.module(new ServiceModuleB()); final Module moduleB2 = DependencyInjection.module(new ServiceModuleB()); final Context context = DependencyInjection .context(moduleA1).context(moduleB1) .context(moduleA2).context(moduleB2); context.get(Service.class); context.remove(moduleA1); context.get(Service.class); context.remove(moduleB1); context.get(Service.class); context.remove(moduleA2); context.get(Service.class); provideServiceAB provideServiceBB provideServiceAB

×