Skip to content

Kyriakum/ldil

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lightweight Dependency Injection Library

By Kyriakum



Features


Currently supports minimal features as I've just started working on the project.

@Inject annotation to inject a field (Constructor injection is not yet supported :( )

@Prototype annotation to define concrete classes you want injected as prototype (New instance each with object instantion)

@Singleton annotation to define concrete classes as singleton (One instance for all objects)

Example code:

  public static void main(String[] args) {
        DependencyProvider dependencyProvider=new DependencyProvider();
        Injector injector=new Injector(dependencyProvider);
        injector.getMappingService().bindClassToClass(TestInterface.class,TestConcrete.class);
        TestObject obj = injector.createInstance(TestObject.class);
        }

Yay! TestObject was injected with a TestConcrete object! Wow!


License


This project is licensed under the MIT License - see the LICENSE file for details.


ToDos


  • Handle RuntimeExceptions with custom exceptions.
  • Include slf4j for logging.
  • Add dependency injection to constructors.

About

Lightweight Dependency Injection Library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages