@Override
    protected void onInit() {
        super.onInit();

        // This is an in-memory realm only - no need for an additional cache when we're already
        // as memory-efficient as we can be.

        Ini ini = getIni();
        String resourcePath = getResourcePath();

        if (!CollectionUtils.isEmpty(this.users) || !CollectionUtils.isEmpty(this.roles)) {
            if (!CollectionUtils.isEmpty(ini)) {
                LOGGER.warn("Users or Roles are already populated.  Configured Ini instance will be ignored.");
            }
            if (StringUtils.hasText(resourcePath)) {
                LOGGER.warn("Users or Roles are already populated.  resourcePath '{}' will be ignored.", resourcePath);
            }

            LOGGER.debug("Instance is already populated with users or roles.  No additional user/role population "
                    + "will be performed.");
            return;
        }

        if (CollectionUtils.isEmpty(ini)) {
            LOGGER.debug("No INI instance configuration present.  Checking resourcePath...");

            if (StringUtils.hasText(resourcePath)) {
                LOGGER.debug("Resource path {} defined.  Creating INI instance.", resourcePath);
                ini = Ini.fromResourcePath(resourcePath);
                if (!CollectionUtils.isEmpty(ini)) {
                    setIni(ini);
                }
            }
        }

        if (CollectionUtils.isEmpty(ini)) {
            String msg = "Ini instance and/or resourcePath resulted in null or empty Ini configuration.  Cannot "
                    + "load account data.";
            throw new IllegalStateException(msg);
        }

        processDefinitions(ini);
    }
Sets the Ini instance used to configure this realm.  Provided for JavaBeans-style configuration of this
realm, particularly useful in Dependency Injection environments.

@param ini the Ini instance which will be inspected to create accounts, groups and permissions for this realm.
core/src/main/java/org/apache/shiro/realm/text/IniRealm.java