Governator — Lifecycle and Dependency Injection

by Jordan Zimmerman

Yahhh — PostConstruct me now unt PreDestroy me lay-tuh


Governator is a library of extensions and utilities that extend Google Guice to provide:

  • Classpath scanning and automatic binding
  • Lifecycle management
  • Configuration to field mapping
  • Field validation
  • Parallelized object warmup
  • Lazy singleton support
  • Generic binding annotations

Governator is another component in the growing Netflix Open Source Platform. See the Governator website at Github for complete details:

Why the name Governator? It Governs the bootstrapping process and all my OSS projects end in “tor” (see: Curator and Exhibitor) — also it makes me laugh ;)

What is Dependency Injection?

According to Wikipedia, Dependency Injection “is a software design pattern that allows a choice of component to be made at run-time rather than compile time.” It is also known as the Inversion of Control Pattern which was originally described by Martin Fowler.

As has been described on the Netflix Tech Blog and elsewhere, Netflix utilizes a highly distributed architecture comprised of many individual service types and many shared libraries. The Netflix Platform Team is responsible for making those libraries and services easy to configure and use. As the number of these libraries and services has grown, our existing methods have reached their limits. That is why we’re moving to a Dependency Injection based system. This system will make it much easier for teams to use common libraries without having to worry about initialization and object lifecycle details.

What is Object Lifecycle?

In many programming languages, Java in particular, there is much more to the lifecycle of an object than just its allocation. The object may need to register itself with existing objects, it may need to load property files, it may need to warm caches, etc.

At Netflix, our shared libraries must load dynamic properties before they are ready to be used (see the Tech Blog post regarding Archaius). Additionally, libraries such as Astyanax need to warm internal caches before they can perform at optimum levels. Users of a library shouldn’t need to concern themselves with these details if possible.

Google Guice

Guice is a Dependency Injection container created and open sourced by Google. We’ve decided to standardize on Guice because it is a small library that is well supported, has strong acceptance by the Java community and is relatively easy to extend to our needs. Using a library like Guice makes the introduction of Dependency Injection much easier.


We hope you find Governator as useful as we do. We’d appreciate any and all feedback on it. Are you interested in working on great open source software? Netflix is hiring!

See Also:

Originally published at on October 29, 2012.

Netflix TechBlog

Learn about Netflix’s world class engineering efforts, company culture, product developments and more.

Netflix Technology Blog

Written by

Learn more about how Netflix designs, builds, and operates our systems and engineering organizations

Netflix TechBlog

Learn about Netflix’s world class engineering efforts, company culture, product developments and more.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade