Closed Mqzn closed 1 month ago
Injecting fields as a dependency inside of command classes without the need for adding them to your constructor.
imperat.registerDependency(SomeDependency.class, ()-> new SomeDependencyClass());
@Command("test") public final class TestCmd { @Dependency private SomeDependencyClass field; }
It can't be final brother, it just can't
Yea, noticed the mistake here and edited it, thanks for telling me.
Added in Commit Added Functional Dependency Injection
Functional Dependency injection
Injecting fields as a dependency inside of command classes without the need for adding them to your constructor.
Registering the dependency injector
Injecting dependency example: