You are previewing Google Guice: Agile Lightweight Dependency Injection Framework.
O'Reilly logo
Google Guice: Agile Lightweight Dependency Injection Framework

Book Description

Guice (pronounced "Juice") is the Jolt Award winning, 100% Java icing on the cake of Java dependency injection. Unlike other popular DI frameworks such as Spring, Guice fully embraces modern Java language features and combines simplicity with stunning performance and developer-friendliness.

Google Guice: Agile Lightweight Dependency Injection Framework will not only tell you "how," it will also tell you "why" and "why not," so that all the knowledge you gain will be as widely applicable as possible. Filled with examples and background information, this book is an invaluable addition to your knowledge of modern agile Java.

Table of Contents

  1. Google Guice: Agile Lightweight Dependency Injection Framework
  2. 1. Setting the Stage
    1. The Problem
    2. A Fortunate Example
    3. Dependency Injection
    4. DI, Guice Style
    5. Summary
  3. 2. Enter Guice
    1. Getting Guice
    2. Preparing the Code
    3. Specifying an Implementation
    4. Bootstrapping
    5. Choosing Between Implementations
    6. Implicit Bindings
    7. Scoping
    8. Debunking Myths
    9. Summary
  4. 3. From Journeyman to Bob
    1. Providers
    2. @Named
    3. Binding Constants
    4. Binding Generic Types
    5. Properties
    6. Static Injection
    7. Custom Scopes
    8. Web Scopes
    9. Organizing Modules
    10. The Binding EDSL
    11. How Guice Resolves Dependencies
    12. Summary
  5. 4. Aspect-Oriented Programming
    1. AOP for Mere Mortals
    2. How Guice AOP Works
    3. Method Interception
    4. Phoning Home
    5. Summary
  6. 5. Integrating with the Web
    1. The Integration Challenge
    2. Bootstrapping
    3. Inviting Servlets to the Club
    4. Configuration Discovery
    5. Struts 2
    6. Wicket
    7. Where Are the Web Scopes?
    8. Warp Servlet
    9. Summary
  7. 6. Practical Guice
    1. Requirements
    2. The Big Picture
    3. Project Structure
    4. Setting Up Struts 2
    5. Getting Guiced
    6. Defining the Model
    7. Database Access with Warp Persist
    8. Implementing the Data Access Layer
    9. The Home Screen
    10. The Create and Edit Screens
    11. Unit Testing
    12. Summary
  8. 7. Guice Recipes
    1. Sharing Singletons
    2. Binding Collections
    3. Designing Libraries and Limiting Visibility
    4. Viral Annotations
    5. Mixing Scopes
    6. Integrating Spring
    7. Logging
    8. Integrating JNDI
    9. Using JMX
    10. Summary
  9. 8. The Future
    1. The Grand Plan
    2. Growing an Extensible Platform
    3. Better Up-Front Checking
    4. Keeping Guice Simple and Making It Simpler
    5. Improved Tooling Support
    6. Addressing DI Shortcomings
    7. Standardization
    8. Summary
  10. A. Assorted Sweets
    1. Binder Syntax Explained
    2. Hello Servlet Guice
    3. Hello Wicket Guice
    4. Hello Warp Servlet
    5. SessionPerRequestInterceptor
  11. Copyright