A set of Java annotation-processing code generators, including AutoValue, AutoFactory, AutoService and Common helpers.
google/guice
Guice is a lightweight dependency injection framework for Java 11+ that removes the need for factories and direct object construction.
- Stars
- 12,730
- Forks
- 1,675
- Open issues
- 372
- Last commit
- 7 days ago
What is it?
Guice is a dependency injection framework for Java developed by Google. Its core idea is that classes declare their dependencies with @Inject, and Guice supplies those objects, so application code does not need to call new or depend on factory classes. This makes code easier to change, unit test, and reuse in different contexts.
Guice builds on Java's type-safe features and aims to keep behavior predictable, avoiding hidden magic. It focuses on a small core and provides extension points rather than adding every feature to the framework. When configuration errors occur, it produces descriptive messages to help diagnose them.
The project is published to Maven Central as the core artifact com.google.inject:guice, with optional extension modules for areas such as assisted injection, JMX, JNDI, persistence, Spring, and Dagger interoperability. Versions 6.0.0 and 7.0.0 are functionally equivalent, differing mainly in whether they target the javax or jakarta namespaces.
Key features
- 01Injects dependencies declared with @Inject, reducing manual object construction and factory code.
- 02Type-safe bindings checked by the Java type system.
- 03Optional extension modules for assisted injection, persistence, JMX, JNDI, Spring and Dagger.
- 04Helpful error messages when injection configuration is wrong.
- 05Available on Maven Central with versions for javax and jakarta namespaces.
Use cases
- Structuring a Java application so components receive their dependencies rather than creating them.
- Making classes easier to unit test by swapping in mock or alternative implementations.
- Integrating dependency injection into a Java web or enterprise project that uses javax or jakarta APIs.
Quick start
- 1
Add the Guice Core Maven dependency (com.google.inject:guice) to your project
- 2
Find the latest version on Maven Central and set it in the dependency
Things to know
- Requires Java 11 or newer.
- Version 6.0.0 targets javax packages, while 7.0.0 targets jakarta packages, so pick the one matching your stack.
In collections
Topics
FAQ
- What is guice?
- Guice is a lightweight dependency injection framework for Java 11+ that removes the need for factories and direct object construction. Guice is a dependency injection framework for Java developed by Google. Its core idea is that classes declare their dependencies with @Inject, and Guice supplies those objects, so application code does not need to call new or depend on factory classes. This makes code easier to change, unit test, and reuse in different contexts.
- Is guice free to use? What license does it have?
- guice is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
- Is guice still maintained?
- Actively maintained. The last commit to guice was on Oct 30, 2026.
- What can I use guice for?
- Structuring a Java application so components receive their dependencies rather than creating them. Making classes easier to unit test by swapping in mock or alternative implementations. Integrating dependency injection into a Java web or enterprise project that uses javax or jakarta APIs.
- How do I install guice?
- Add the Guice Core Maven dependency (com.google.inject:guice) to your project Find the latest version on Maven Central and set it in the dependency
- Where can I get guice?
- The source code and installation instructions are on GitHub: https://github.com/google/guice
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A modular Java application framework offering dependency injection, auto-configuration, Web MVC, Netty-based HTTP serving and data access, inspired by Spring.
A progressive Node.js framework for building efficient, scalable server-side applications in TypeScript or JavaScript.
A PHP web application framework with expressive syntax, covering routing, dependency injection, migrations, queues and broadcasting.
The foundational Java framework for building enterprise applications, providing dependency injection, MVC, and infrastructure support for the wider Spring ecosystem.
Build optimized Docker and OCI container images for Java applications with Maven or Gradle, without a Docker daemon.