{
configuration.refresh();
ShiroIniConfiguration config = configuration.get();
String iniResourcePath = config.iniResourcePath().get() == null ? "classpath:shiro.ini" : config.iniResourcePath().get();
sce.getServletContext().setInitParameter( "shiroConfigLocations", iniResourcePath );
WebEnvironment env = initEnvironment( sce.getServletContext() );
if ( realmsRefs != null && Iterables.count( realmsRefs ) > 0 ) {
// Register Realms Services
RealmSecurityManager realmSecurityManager = ( RealmSecurityManager ) env.getSecurityManager();
Collection<Realm> iniRealms = new ArrayList<Realm>( realmSecurityManager.getRealms() );
for ( ServiceReference<Realm> realmRef : realmsRefs ) {
iniRealms.add( realmRef.get() );
LOG.debug( "Realm Service '{}' registered!", realmRef.identity() );
}