История изменений
Исправление dizza, (текущая версия) :
package com.mycompany.di;
import javax.inject.Inject;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
public class App {
@Inject private Foo foo;
public Foo getFoo() {
return foo;
}
public static void main(String[] args) {
Injector injector = Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
}
});
App app = injector.getInstance(App.class);
System.out.println(app.getFoo());
}
}
Исходная версия dizza, :
package com.mycompany.di;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Inject;
import com.google.inject.Injector;
public class App {
@Inject private Foo foo;
public Foo getFoo() {
return foo;
}
public static void main(String[] args) {
Injector injector = Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
}
});
App app = injector.getInstance(App.class);
System.out.println(app.getFoo());
}
}