Table of Contents

 

Copyright

Brief Table of Contents

Table of Contents

Praise from the Creator of Guice

Preface

Acknowledgments

About this Book

About the Cover Illustration

Chapter 1. Dependency injection: what’s all the hype?

1.1. Every solution needs a problem

1.1.1. Seeing objects as services

1.2. Pre-DI solutions

1.2.1. Construction by hand

1.2.2. The Factory pattern

1.2.3. The Service Locator pattern

1.3. Embracing dependency injection

1.3.1. The Hollywood Principle

1.3.2. Inversion of Control vs. dependency injection

1.4. Dependency injection in the real world

1.4.1. Java

1.4.2. DI in other languages and libraries

1.5. Summary

Chapter 2. Time for injection

2.1. Bootstrapping the injector

2.2. Constructing objects with dependency injection

2.3. Metadata and injector configuration

2.3.1. XML injection in Spring

2.3.2. From XML to in-code configuration

2.3.3. Injection in PicoContainer

2.3.4. Revisiting Spring and autowiring

2.4. Identifying dependencies for injection

2.4.1. Identifying by string keys

2.4.2. Limitations of string keys

2.4.3. Identifying by type

2.4.4. Limitations of identifying by type

2.4.5. Combinatorial keys: a comprehensive solution

2.5. Separating infrastructure and application logic

2.6. Summary

Chapter 3. Investigating DI

3.1. Injection idioms

3.1.1. Constructor injection

3.1.2. Setter injection

3.1.3. Interface injection

3.1.4. Method decoration (or AOP injection)

3.2. Choosing an injection idiom