Blogs, articles, books on Guice.
External Documentation
Books
Dependency Injection by Dhanji Prasanna
In a traditional object-oriented application, a primary program controls secondary pieces of code, such as classes in a module, library, or framework. Dependency Injection (DI) is a technique that inverts this control, using an external mechanism to insert—or inject—a reference to an implementation of a service into an object. This allows you to build complex OO applications in a more testable, maintainable, and business-focused manner.
Google Guice by Robbie Vanbrabant
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.
Videos
Big Modular Java with Guice
An introduction to Guice by Dhanji R. Prasanna and Jesse Wilson, at Google I/O 2009. Learn how Google uses the fast, lightweight Guice framework to power some of the largest and most complex applications in the world. Supporting scores of developers, and steep testing and scaling requirements for the web, Guice proves that there is still ample room for a simple, type-safe and dynamic programming model in Java. This session will serve as a simple introduction to Guice, its ecosystem and how we use it at Google. PDF slides
Introduction to Google Guice: Programming is fun again!
PDF slides from the sold-out technical session at !JavaOne 2009.
Articles
Dependency injection with Guice by Nicholas Lesiecki
Guice is a dependency injection (DI) framework. I've suggested for years that developers use DI, because it improves maintainability, testability, and flexibility. By watching engineers react to Guice, I've learned that the best way to convince a programmer to adopt a new technology is to make it really easy. Guice makes DI really easy, and as a result, the practice has taken off at Google. I hope to continue in the same vein in this article by making it really easy for you to learn Guice.
Guicing Up Your Testing by Dick Wall
This article examines the simplest and most obvious use case for the Guice container, for mocking or faking objects in unit tests.
Also available in Portuguese
Squeezing More Guice from Your Tests with EasyMock by Dick Wall
It should be apparent that making Invoice something that Guice creates directly is an incorrect design decision. Instead, you can mix it with another pattern instead: Factory.
Blogs
Guice with GWT
Configure your serverside app to serve up a backend for GWT apps. Obtain the
Guice JAR files, extend GWT’s RemoteServiceServlet, extend Guice’s
GuiceServletContextListener, extend Guice’s ServletModule, set all
RemoteService relative paths to GWT.rpc, and configure GuiceFilter and
your context listener in web.xml.
Refactoring to Guice: Part 1 of N
Guide for migrating from factories to dependency injection. In this N-part series, I'm attempting to document some patterns for improving your code with Guice. In each example, I'll start with sample code, explain what I don't like about it, and then show how I clean it up.
What's a Hierarchical Injector?
The premise is simple. @Inject anything, even stuff you don't know at injector-creation time. So our DeLorean class would look exactly as it would if EnergySource was constant:
TypeResolver tells you what List.get() returns
What the new methods on TypeLiteral do.
Simpler service interfaces with Guice
A brief discussion on contextual APIs.
Guice AOP Example
@Trace("note goes here")
public void bye() {
System.out.println("see you later");
}
Alternative way to integrate Guice with Wicket
Explains a better way to integrate Guice and Wicket, using Guice 2.0 and ServletModule which allows you to get rid of even more XML in your projects!
-
User's Guide
-
Integration
-
Extensions
-
Internals
-
Releases
-
Community