Transcends implementation details...covers customary and effective use of DI.
In object-oriented programming, a central program normally controls other objects in a module, library, or framework. With dependency injection, this pattern is inverted—a reference to a service is placed directly into the object which eases testing and modularity. Spring or Google Guice use dependency injection so you can focus on your core application and let the framework handle infrastructural concerns.
Dependency Injection explores the DI idiom in fine detail, with numerous practical examples that show you the payoffs. You'll apply key techniques in Spring and Guice and learn important pitfalls, corner-cases, and design patterns.
about this book
about the cover illustration
1. Dependency injection: what’s all the hype?
1.1. Every solution needs a problem
1.2. Pre-DI solutions
1.3. Embracing dependency injection
1.4. Dependency injection in the real world
2. Time for injection
2.1. Bootstrapping the injector
2.2. Constructing objects with dependency injection
2.3. Metadata and injector configuration
2.4. Identifying dependencies for injection
2.5. Separating infrastructure and application logic
3. Investigating DI
3.1. Injection idioms
3.2. Choosing an injection idiom
3.3. Not all at once: partial injection
3.4. Injecting objects in sealed code
4. Building modular applications
4.1. Understanding the role of an object
4.2. Separation of concerns (my pants are too tight!)
4.3. Testing components
4.4. Different deployment profiles
5. Scope: a fresh breath of state
5.1. What is scope?
5.2. The no scope (or default scope)
5.3. The singleton scope
5.4. Domain-specific scopes: the web
6. More use cases in scoping
6.1. Defining a custom scope
6.2. Pitfalls and corner cases in scoping
6.3. Leveraging the power of scopes
7. From birth to death: object lifecycle
7.1. Significant events in the life of objects
7.2. One size doesn’t fit all (domain-specific lifecycle)
7.3. A real-world lifecycle scenario: stateful EJBs
7.4. Lifecycle and lazy instantiation
7.5. Customizing lifecycle with postprocessing
7.6. Customizing lifecycle with multicasting
8. Managing an object’s behavior
8.1. Intercepting methods and AOP
8.2. Enterprise use cases for interception
8.3. Pitfalls and assumptions about interception and proxying
9. Best practices in code design
9.1. Objects and visibility
9.2. Objects and design
9.3. Objects and concurrency
10. Integrating with third-party frameworks
10.1. Fragmentation of DI solutions
10.2. Lessons for framework designers
10.3. Programmatic configuration to the rescue
11. Dependency injection in action!
11.1. Crosstalk: a Twitter clone!
11.2. Setting up the application
11.3. Configuring Google Sitebricks
11.4. Crosstalk’s modularity and service coupling
11.5. The presentation layer
11.6. The persistence layer
11.7. The security layer
11.8. Tying up to the web lifecycle
11.9. Finally: up and running!
Appendix A: The Butterfly Container
Appendix B: SmartyPants for Adobe Flex
- How to apply it (Understand it first!)
- Design patterns and nuances
- Spring, Google Guice, PicoContainer, and more
- How to integrate DI with Java frameworks
About the reader
Readers need a working knowledge of Java but no prior experience with DI is assumed.
placing your order...Don't refresh or navigate away from the page.