Micro DI module

Some time ago I wrote a small dependency injection library (really small, footprint is about 10 Kb!) and I’d like to share it with you.

The project page on git is here.

The project is released under Apache 2.0 license.

You can easily add this to your maven project – see readme.md

Sample usage:

public interface Inferior {
    int foo();

public interface Superior {
    int bar();

public class InferiorImpl implements Inferior {
    @Override public int foo() { return 1; }

public class SuperiorImpl implements Superior {
    @Resource protected Inferior inferior;

    @Override public int bar() { return 10 + inferior.foo(); }

public void shouldInjectOneBeanWithinAnother() {
    context.registerBean(new SuperiorImpl());
    context.registerBean(new InferiorImpl());

    final Superior superior = context.getBean(Superior.class);
    assertEquals(11, superior.bar());

Leave a Reply

Your email address will not be published. Required fields are marked *