Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.
maxharp3r edited this page Apr 16, 2013 · 7 revisions

Grapht Dependency Injector

This is the documentation & project planning wiki for Grapht, the dependency injector developed by GroupLens Research.

Getting Started

To start using grapht, configure and build an Injector.

import org.grouplens.grapht.Injector;
import org.grouplens.grapht.InjectorBuilder;
...
InjectorBuilder builder = new InjectorBuilder();
builder.bind(MyInterface1.class).to(MyImpl1.class); // singleton
builder.bind(MyInterface2.class).to(MyImpl2.class); // new instance per getInstance
Injector injector = builder.build();

Then, you can use this injector to retrieve instances:

injector.getInstance(MyInterface1.class);

Make sure that your injectables (like MyImpl1 and MyImpl2) have a default constructor, or that the constructor is annotated with @Inject and depends on injectable types.

Development

  • Roadmap for planning Grapht releases.
Clone this wiki locally