package act.di.guice;

import act.app.App;
import act.di.DependencyInjector;
import act.di.DiBinder;
import act.event.ActEventListener;
import act.event.ActEventListenerBase;
import act.plugin.AppServicePlugin;

import java.util.EventObject;

public class InjectorInitializer extends AppServicePlugin {
    @Override
    protected void applyTo(final App app) {
        app.eventBus().bind(DiBinder.class, new ActEventListenerBase<DiBinder>() {
            @Override
            public void on(DiBinder event) throws Exception {
                GuiceDependencyInjector injector = app.injector();
                if (null == injector) {
                    injector = new GuiceDependencyInjector(app);
                }
                injector.registerDiBinder(event);
            }
        });
        app.jobManager().beforeAppStart(new Runnable() {
            @Override
            public void run() {
                DependencyInjector injector = app.injector();
                if (null == injector) {
                    new GuiceDependencyInjector(app);
                }
            }
        });
    }
}

@@ -537,21 +537,16 @@
         
-Guice
 Dependen
@@ -709,33 +709,164 @@
    %7D
-%0A                
+ else if (!(injector instanceof GuiceDependencyInjector)) %7B%0A                    return;%0A                %7D%0A                ((GuiceDependencyInjector)
 injector
 .reg
@@ -861,16 +861,17 @@
 injector
+)
 .registe

fix type mismatch issue