8. Dependency Injection Types
• Constructor Injection
• Setter Injection
• Annotated Field Injection
• Annotated Method Injection
• Typed Field Injection
• Named Field/Method Injection
9. Constructor Injection
• Type 3
• As much as possible, to create valid objects at construction
time
• What it means to create a valid object in an obvious place
• You to clearly hide any fields that are immutable by simply not
providing a setter
10. Setter Injection
• Type 2
• If you have a lot of constructor parameters
• If you have multiple ways to construct a valid object
• If you have simple parameters such as strings