|
ExternalDocumentation
Blogs, articles, books on Guice.
External DocumentationBooksDependency Injection by Dhanji PrasannaIn 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 VanbrabantGoogle 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. VideosBig Modular Java with GuiceAn 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. Introduction to Google Guice: Programming is fun again!PDF slides from the sold-out technical session at JavaOne 2009. ArticlesDependency injection with Guice by Nicholas LesieckiGuice 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 WallThis 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 WallIt 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. BlogsGuice with GWTConfigure 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 NGuide 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() returnsWhat the new methods on TypeLiteral do. Simpler service interfaces with GuiceA 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 WicketExplains 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! | |
► Sign in to add a comment
FYI, this list is totally a work in progress. Post links to your best Guice docs in the comments!
I have written a tutorial on how to do multi binding in Guice. It covered bind multiple instances of same type, bind a set, map list and decorator, also how to use Guice to provide extension point. The url is: http://taowen.blogspot.com/2009_06_16_archive.html
I have created a wiki page to share my experience with Google Guice at
http://code.google.com/p/sacct/wiki/SAcctServerImplementationExperienceWithGoogleGuice
Hi, the slides for "Introduction to Google Guice: Programming is fun again!" are now located in an archive which you can download at: http://download.oracle.com/javaone/javaone2009-core-se.zip
The link "Dependency injection with Guice by Nicholas Lesiecki" on this page is broken. Returns a 404 page.
The correct link to that resource is http://www.ibm.com/developerworks/java/library/j-guice/index.html
Here is a blog post on how to write Guice extensions: http://developer.vz.net/2012/02/08/extending-guice-2/