public static Config build(final BaseHazelcastProperties hz) {
        val cluster = hz.getCluster();
        val config = new Config();

        config.setLicenseKey(hz.getCore().getLicenseKey());
        config.getJetConfig().setEnabled(hz.getCore().isEnableJet());

        if (cluster.getCore().getCpMemberCount() > 0) {
            config.getCPSubsystemConfig().setCPMemberCount(cluster.getCore().getCpMemberCount());
        }

        buildManagementCenterConfig(hz, config);

        val networkConfig = new NetworkConfig()
            .setPort(cluster.getNetwork().getPort())
            .setPortAutoIncrement(cluster.getNetwork().isPortAutoIncrement());

        buildNetworkSslConfig(networkConfig, hz);

        if (StringUtils.hasText(cluster.getNetwork().getNetworkInterfaces())) {
            networkConfig.getInterfaces().setEnabled(true);
            StringUtils.commaDelimitedListToSet(cluster.getNetwork().getNetworkInterfaces())
                .forEach(faceIp -> networkConfig.getInterfaces().addInterface(faceIp));
        }

        if (StringUtils.hasText(cluster.getNetwork().getLocalAddress())) {
            config.setProperty(BaseHazelcastProperties.HAZELCAST_LOCAL_ADDRESS_PROP, cluster.getNetwork().getLocalAddress());
        }
        if (StringUtils.hasText(cluster.getNetwork().getPublicAddress())) {
            config.setProperty(BaseHazelcastProperties.HAZELCAST_PUBLIC_ADDRESS_PROP, cluster.getNetwork().getPublicAddress());
            networkConfig.setPublicAddress(cluster.getNetwork().getPublicAddress());
        }

        cluster.getNetwork().getOutboundPorts().forEach(networkConfig::addOutboundPortDefinition);

        if (cluster.getWanReplication().isEnabled()) {
            if (!StringUtils.hasText(hz.getCore().getLicenseKey())) {
                throw new IllegalArgumentException("Cannot activate WAN replication, a Hazelcast enterprise feature, without a license key");
            }
            LOGGER.warn("Using Hazelcast WAN Replication requires a Hazelcast Enterprise subscription. Make sure you "
                + "have acquired the proper license, SDK and tooling from Hazelcast before activating this feature.");
            buildWanReplicationSettingsForConfig(hz, config);
        }

        val joinConfig = cluster.getDiscovery().isEnabled()
            ? createDiscoveryJoinConfig(config, cluster, networkConfig)
            : createDefaultJoinConfig(cluster);
        LOGGER.trace("Created Hazelcast join configuration [{}]", joinConfig);
        networkConfig.setJoin(joinConfig);

        LOGGER.trace("Created Hazelcast network configuration [{}]", networkConfig);
        config.setNetworkConfig(networkConfig);
        config.getSerializationConfig().setEnableCompression(hz.getCore().isEnableCompression());
        config.getSerializationConfig().setUseNativeByteOrder(true);
        config.getSerializationConfig().setAllowUnsafe(true);
        
        val instanceName = StringUtils.hasText(cluster.getCore().getInstanceName())
            ? SpringExpressionLanguageValueResolver.getInstance().resolve(cluster.getCore().getInstanceName())
            : UUID.randomUUID().toString();
        LOGGER.trace("Configuring Hazelcast instance name [{}]", instanceName);
        return config.setInstanceName(instanceName)
            .setProperty(BaseHazelcastProperties.HAZELCAST_DISCOVERY_ENABLED_PROP,
                BooleanUtils.toStringTrueFalse(cluster.getDiscovery().isEnabled()))
            .setProperty(BaseHazelcastProperties.IPV4_STACK_PROP, String.valueOf(cluster.getNetwork().isIpv4Enabled()))
            .setProperty(BaseHazelcastProperties.LOGGING_TYPE_PROP, cluster.getCore().getLoggingType())
            .setProperty(BaseHazelcastProperties.MAX_HEARTBEAT_SECONDS_PROP, String.valueOf(cluster.getCore().getMaxNoHeartbeatSeconds()));
    }
Build config.

@param hz the hz
@return the config
support/cas-server-support-hazelcast-core/src/main/java/org/apereo/cas/hz/HazelcastConfigurationFactory.java