MCPcopy Index your code
hub / github.com/google/guice

github.com/google/guice @7.0.0 sqlite

repository ↗ · DeepWiki ↗ · release 7.0.0 ↗
8,257 symbols 34,273 edges 621 files 1,454 documented · 18% 12 cross-repo links
README

Guice

Overview

Put simply, Guice alleviates the need for factories and the use of new in your Java code. Think of Guice's @Inject as the new new. You will still need to write factories in some cases, but your code will not depend directly on them. Your code will be easier to change, unit test and reuse in other contexts.

Guice embraces Java's type safe nature. You might think of Guice as filling in missing features for core Java. Ideally, the language itself would provide most of the same features, but until such a language comes along, we have Guice.

Guice helps you design better APIs, and the Guice API itself sets a good example. Guice is not a kitchen sink. We justify each feature with at least three use cases. When in doubt, we leave it out. We build general functionality which enables you to extend Guice rather than adding every feature to the core framework.

Guice aims to make development and debugging easier and faster, not harder and slower. In that vein, Guice steers clear of surprises and magic. You should be able to understand code with or without tools, though tools can make things even easier. When errors do occur, Guice goes the extra mile to generate helpful messages.

For an introduction to Guice and a comparison to new and the factory pattern, see Bob Lee's video presentation. After that, check out our user's guide.

We've been running Guice in mission critical applications since 2006, and now you can, too. We hope you enjoy it as much as we do.

Installation Instructions

Guice Core (Maven)

<dependency>
  <groupId>com.google.inject</groupId>
  <artifactId>guice</artifactId>

  <version>{version}</version>
</dependency>

Guice Extension (Maven)

<dependency>
  <groupId>com.google.inject.extensions</groupId>

  <artifactId>guice-{extension-name}</artifactId>

  <version>{version}</version>
</dependency>

See Maven Central for more details, including snippets for other build systems such as Gradle, Ivy, sbt, and more.


jolt award

Extension points exported contracts — how you extend this code

Scope (Interface)
A scope is a level of visibility that instances provided by Guice may have. By default, an instance created by the {@lin [16 …
core/src/com/google/inject/Scope.java
ThrowingProvider (Interface)
Alternative to the Guice com.google.inject.Provider that throws a checked Exception. Users may not inject {@code [125 …
extensions/throwingproviders/src/com/google/inject/throwingproviders/ThrowingProvider.java
ServletModuleTargetVisitor (Interface)
A visitor for the servlet extension. If your BindingTargetVisitor implements this interface, bindings create [36 implementers]
extensions/servlet/src/com/google/inject/servlet/ServletModuleTargetVisitor.java
AssistedInjectTargetVisitor (Interface)
A visitor for the AssistedInject extension. If your BindingTargetVisitor implements this interface, bindings [36 implementers]
extensions/assistedinject/src/com/google/inject/assistedinject/AssistedInjectTargetVisitor.java
A (Interface)
(no doc) [6 implementers]
core/test/com/googlecode/guice/bundle/OSGiTestActivator.java
ManagedBindingMBean (Interface)
JMX interface to bindings. @author crazybob@google.com (Bob Lee) [4 implementers]
extensions/jmx/src/com/google/inject/tools/jmx/ManagedBindingMBean.java
PersistService (Interface)
Persistence provider service. Use this to manage the overall startup and stop of the persistence module(s). TODO(use [3 …
extensions/persist/src/com/google/inject/persist/PersistService.java
InjectorGrapher (Interface)
Guice injector grapher. Renders the guice dependency graph for an injector. It can render the whole dependency graph or [2 …
extensions/grapher/src/com/google/inject/grapher/InjectorGrapher.java

Core symbols most depended-on inside this repo

getInstance
called by 1239
core/src/com/google/inject/Injector.java
createInjector
called by 1119
core/src/com/google/inject/Guice.java
bind
called by 1025
core/src/com/google/inject/Binder.java
get
called by 1024
core/src/com/google/inject/Key.java
toInstance
called by 565
core/src/com/google/inject/binder/LinkedBindingBuilder.java
named
called by 478
core/src/com/google/inject/name/Names.java
binder
called by 353
core/src/com/google/inject/PrivateModule.java
equals
called by 341
extensions/assistedinject/test/com/google/inject/assistedinject/FactoryProvider2Test.java

Shape

Method 6,286
Class 1,607
Interface 312
Enum 52

Languages

Java100%

Modules by API surface

extensions/assistedinject/test/com/google/inject/assistedinject/FactoryProvider2Test.java150 symbols
extensions/throwingproviders/test/com/google/inject/throwingproviders/CheckedProviderTest.java149 symbols
core/test/com/google/inject/spi/ProviderMethodsTest.java136 symbols
core/test/com/google/inject/ScopesTest.java132 symbols
core/test/com/googlecode/guice/bundle/OSGiTestActivator.java112 symbols
core/src/com/google/inject/internal/RealMapBinder.java107 symbols
extensions/assistedinject/test/com/google/inject/assistedinject/FactoryProviderTest.java101 symbols
core/test/com/google/inject/RestrictedBindingSourceTest.java99 symbols
core/test/com/google/inject/CircularDependencyTest.java99 symbols
core/src/com/google/inject/internal/RealOptionalBinder.java91 symbols
core/test/com/google/inject/ProvisionListenerTest.java88 symbols
core/test/com/google/inject/ImplicitBindingTest.java86 symbols

Dependencies from manifests, versioned

aopalliance:aopalliance1.0 · 1×
biz.aQute:bnd0.0.384 · 1×
com.google.auto.value:auto-value1.6.3 · 1×
com.google.auto.value:auto-value-annotations1.6.3 · 1×
com.google.code.findbugs:jsr3053.0.1 · 1×
com.google.dagger:dagger2.22.1 · 1×
com.google.dagger:dagger-producers2.22.1 · 1×
com.google.errorprone:error_prone_annotations2.18.0 · 1×
com.google.guava:guava31.0.1-jre · 1×
com.google.guava:guava-testlib31.0.1-jre · 1×
com.google.inject.extensions:guice-assistedinject
com.google.inject.extensions:guice-dagger-adapter

For agents

$ claude mcp add guice \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact