@Component & @Injectable
This is enough for Mineject to initialize the TestManager object and add it to the list of dependencies.
import xyz.failutee.mineject.annotation.Component;
@Component
public class TestManager {
public void test() {
System.out.println("Its just a test!");
}
}
Now if you want to inject the TestManager object into the constructor you can do it like this.
Remember to use the @Injectable annotation in the constructor!
import xyz.failutee.mineject.annotation.Component;
import xyz.failutee.mineject.annotation.Injectable;
@Component
public class IAmDependentOnAnotherClass {
private final TestManager testManager;
@Injectable
public IAmDependentOnAnotherClass(TestManager testManager) {
this.testManager = testManager;
}
public TestManager getTestManager() {
return this.testManager;
}
}
Last updated