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 dependency injection 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.

  • Learn simple annotation--driven dependency injection, scoping and aspect-oriented programming, and why it all works the way it works

  • Be the first to familiarize yourself with concepts that are likely to be included in a future Java EE or SE release (through JSR 299)

  • Get things done without having to write any XML

Table of contents

  1. Cover Page
  2. Title Page
  3. Contents
  4. About the Author
  5. Chapter 1: Setting the Stage
    1. The Problem
    2. A Fortunate Example
    3. Dependency Injection
    4. DI, Guice Style
    5. Summary
  6. Chapter 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
  7. Chapter 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
  8. Chapter 4: Aspect-Oriented Programming
    1. AOP for Mere Mortals
    2. How Guice AOP Works
    3. Method Interception
    4. Phoning Home
    5. Summary
  9. Chapter 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
  10. Chapter 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
  11. Chapter 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
  12. Chapter 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
  13. Appendix: Assorted Sweets
    1. Binder Syntax Explained
    2. Hello Servlet Guice
    3. Hello Wicket Guice
    4. Hello Warp Servlet
    5. SessionPerRequestInterceptor
  14. Copyright

Product information

  • Title: Google Guice: Agile Lightweight Dependency Injection Framework
  • Author(s): Robbie Vanbrabant
  • Release date: April 2008
  • Publisher(s): Apress
  • ISBN: 9781590599976