By Kyriakum
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!
This project is licensed under the MIT License - see the LICENSE file for details.
- Handle RuntimeExceptions with custom exceptions.
- Include slf4j for logging.
- Add dependency injection to constructors.