Skip to content

SleimanJneidi/simpleDI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simpleDI

SimpleDI is a simple dependency injection implementation for java, simpleDI ia a proof of concept rather than a real framework.SimpleDI uses AspectJ to hijack objects' instantiations in order to instantiate their dependencies.

Examples

public interface IFoo {
    String fn();
}

public class Bar implements IFoo{

    @Override
    public String fn() {
        return "Bar";
    }
}
@Service
public class SimpleService {

    @Injectable
    private IFoo foo;
}
// Inject Bar to IFoo
DIBinding fooDIBinding = new DIBinding.BindingBuilder(IFoo.class).to(Bar.class).build();
DIContext.INSTANCE.addBinding(fooDIBinding);
DIContext.INSTANCE.injectDependencies();

Todo

  • Support lazy initialisation of dependencies

About

A Simple Java Library for Dependency Injection

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages