import acorn.Acorn;
import acorn.Module;
import acorn.annotations.Component;
import acorn.annotations.Inject;
@Component
public class MyComponent {
@Inject
private AnotherComponent anotherComponent;
public void doSomething() {
System.out.println("Hello Acorn!");
anotherComponent.doAnotherThing();
}
}
@Component
public class AnotherComponent {
public void doAnotherThing() {
System.out.println("Doing another thing...");
}
}
public class MyApp {
public static void main(String[] args) {
Acorn acorn = new Acorn();
acorn.register(MyComponent.class);
acorn.register(AnotherComponent.class);
MyComponent myComponent = acorn.get(MyComponent.class);
myComponent.doSomething();
}
}