protected boolean isAutoApplyRealms(SecurityManager securityManager) {
        boolean autoApply = true;
        if (securityManager instanceof RealmSecurityManager) {
            //only apply realms if they haven't been explicitly set by the user:
            RealmSecurityManager realmSecurityManager = (RealmSecurityManager) securityManager;
            Collection<Realm> realms = realmSecurityManager.getRealms();
            if (!CollectionUtils.isEmpty(realms)) {
                LOGGER.info("Realms have been explicitly set on the SecurityManager instance - auto-setting of "
                        + "realms will not occur.");
                autoApply = false;
            }
        }
        return autoApply;
    }
Creates a new instance.  See the {@link #getInstance()} JavaDoc for detailed explanation of how an INI
source will be resolved to use to build the instance.
core/src/main/java/org/apache/shiro/ini/IniSecurityManagerFactory.java