@Test public void testEventBusAware() throws Exception { final MockRealm mockRealm = createMock(MockRealm.class); final ShiroModule shiroModule = new ShiroModule() { @Override protected void configureShiro() { bindRealm().to(MockRealm.class); binder().bind(MockEventBusAware.class).asEagerSingleton(); expose(MockEventBusAware.class); } @Provides public MockRealm createRealm() { return mockRealm; } }; Injector injector = Guice.createInjector(shiroModule); EventBus eventBus = injector.getInstance(EventBus.class); SecurityManager securityManager = injector.getInstance(SecurityManager.class); MockEventBusAware eventBusAware = injector.getInstance(MockEventBusAware.class); assertSame(eventBus, eventBusAware.eventBus); assertSame(eventBus, ((DefaultSecurityManager)securityManager).getEventBus()); }
protected final LinkedBindingBuilder<Realm> bindRealm() { Multibinder<Realm> multibinder = Multibinder.newSetBinder(binder(), Realm.class); return multibinder.addBinding(); }
ShiroModule extends PrivateModule implements Destroyable { protected final LinkedBindingBuilder<Realm> bindRealm() { Multibinder<Realm> multibinder = Multibinder.newSetBinder(binder(), Realm.class); return multibinder.addBinding(); } }
ShiroModule extends PrivateModule implements Destroyable { protected final LinkedBindingBuilder<Realm> bindRealm() { Multibinder<Realm> multibinder = Multibinder.newSetBinder(binder(), Realm.class); return multibinder.addBinding(); }  }
ShiroModule extends PrivateModule implements Destroyable { protected final LinkedBindingBuilder<Realm> bindRealm() { Multibinder<Realm> multibinder = Multibinder.newSetBinder(binder(), Realm.class); return multibinder.addBinding(); }  void configure(); final void destroy(); void add(Destroyable destroyable); }
ShiroModule extends PrivateModule implements Destroyable { protected final LinkedBindingBuilder<Realm> bindRealm() { Multibinder<Realm> multibinder = Multibinder.newSetBinder(binder(), Realm.class); return multibinder.addBinding(); }  void configure(); final void destroy(); void add(Destroyable destroyable);  }