@Test public void testBindEnvironment() { final MockRealm mockRealm = createMock(MockRealm.class); Injector injector = Guice.createInjector(new ShiroModule() { @Override protected void configureShiro() { bindRealm().to(MockRealm.class); expose(Environment.class); } @Provides public MockRealm createRealm() { return mockRealm; } @Override protected void bindEnvironment(AnnotatedBindingBuilder<Environment> bind) { bind.to(MyEnvironment.class); } }); Environment environment = injector.getInstance(Environment.class); assertNotNull(environment); assertTrue(environment instanceof MyEnvironment); }
protected void bindEnvironment(AnnotatedBindingBuilder<Environment> bind) { bind.to(GuiceEnvironment.class).asEagerSingleton(); }
ShiroModule extends PrivateModule implements Destroyable { protected void bindEnvironment(AnnotatedBindingBuilder<Environment> bind) { bind.to(GuiceEnvironment.class).asEagerSingleton(); } }
ShiroModule extends PrivateModule implements Destroyable { protected void bindEnvironment(AnnotatedBindingBuilder<Environment> bind) { bind.to(GuiceEnvironment.class).asEagerSingleton(); }  }
ShiroModule extends PrivateModule implements Destroyable { protected void bindEnvironment(AnnotatedBindingBuilder<Environment> bind) { bind.to(GuiceEnvironment.class).asEagerSingleton(); }  void configure(); final void destroy(); void add(Destroyable destroyable); }
ShiroModule extends PrivateModule implements Destroyable { protected void bindEnvironment(AnnotatedBindingBuilder<Environment> bind) { bind.to(GuiceEnvironment.class).asEagerSingleton(); }  void configure(); final void destroy(); void add(Destroyable destroyable);  }