I have a module class:
public class AppModule {
@Singleton
public static void bind(ServiceBinder binder) {
binder.bind(MainPage.class, MainPageDesktop.class);
}
I wrote a code to registry that module:
if (isDesktop()) {
RegistryBuilder builder = new RegistryBuilder();
builder.add(AppModule.class);
Registry registry = builder.build();
registry.performRegistryStartup();
}
My MainPage class is: public abstract class MainPage
My MainPageDesktop class is: public class MainPageDesktop extends MainPage
My inject looks like that:
public class SimpleTest {
@Inject
MainPage page;
@Test
public void test() {
if (page != null) {
Log.info("Hello world");
}
}
}
I received that page equals to null. What I do wrong?
Aucun commentaire:
Enregistrer un commentaire