@Test public void testBindSecurityManager() { final MockRealm mockRealm = createMock(MockRealm.class); Injector injector = Guice.createInjector(new ShiroModule() { @Override protected void configureShiro() { bindRealm().to(MockRealm.class); } @Provides public MockRealm createRealm() { return mockRealm; } @Override protected void bindSecurityManager(AnnotatedBindingBuilder<? super SecurityManager> bind) { bind.to(MyDefaultSecurityManager.class); } }); SecurityManager securityManager = injector.getInstance(SecurityManager.class); assertNotNull(securityManager); assertTrue(securityManager instanceof MyDefaultSecurityManager); }
protected void bindSecurityManager(AnnotatedBindingBuilder<? super SecurityManager> bind) { try { bind.toConstructor(DefaultSecurityManager.class.getConstructor(Collection.class)).asEagerSingleton(); } catch (NoSuchMethodException e) { throw new ConfigurationException("This really shouldn't happen. Either something has changed in Shiro, or there's a bug in " + ShiroModule.class.getSimpleName(), e); } }
ShiroModule extends PrivateModule implements Destroyable { protected void bindSecurityManager(AnnotatedBindingBuilder<? super SecurityManager> bind) { try { bind.toConstructor(DefaultSecurityManager.class.getConstructor(Collection.class)).asEagerSingleton(); } catch (NoSuchMethodException e) { throw new ConfigurationException("This really shouldn't happen. Either something has changed in Shiro, or there's a bug in " + ShiroModule.class.getSimpleName(), e); } } }
ShiroModule extends PrivateModule implements Destroyable { protected void bindSecurityManager(AnnotatedBindingBuilder<? super SecurityManager> bind) { try { bind.toConstructor(DefaultSecurityManager.class.getConstructor(Collection.class)).asEagerSingleton(); } catch (NoSuchMethodException e) { throw new ConfigurationException("This really shouldn't happen. Either something has changed in Shiro, or there's a bug in " + ShiroModule.class.getSimpleName(), e); } }  }
ShiroModule extends PrivateModule implements Destroyable { protected void bindSecurityManager(AnnotatedBindingBuilder<? super SecurityManager> bind) { try { bind.toConstructor(DefaultSecurityManager.class.getConstructor(Collection.class)).asEagerSingleton(); } catch (NoSuchMethodException e) { throw new ConfigurationException("This really shouldn't happen. Either something has changed in Shiro, or there's a bug in " + ShiroModule.class.getSimpleName(), e); } }  void configure(); final void destroy(); void add(Destroyable destroyable); }
ShiroModule extends PrivateModule implements Destroyable { protected void bindSecurityManager(AnnotatedBindingBuilder<? super SecurityManager> bind) { try { bind.toConstructor(DefaultSecurityManager.class.getConstructor(Collection.class)).asEagerSingleton(); } catch (NoSuchMethodException e) { throw new ConfigurationException("This really shouldn't happen. Either something has changed in Shiro, or there's a bug in " + ShiroModule.class.getSimpleName(), e); } }  void configure(); final void destroy(); void add(Destroyable destroyable);  }