@Bean
    @RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
    @ConditionalOnEnabledHealthIndicator("pooledLdapConnectionFactoryHealthIndicator")
    public CompositeHealthContributor pooledLdapConnectionFactoryHealthIndicator(
        final CasConfigurationProperties casProperties,
        @Qualifier("pooledLdapConnectionFactoryHealthIndicatorListFactoryBean")
        final ListFactoryBean factoryBean) throws Exception {
        val ldaps = casProperties.getMonitor().getLdap();
        val connectionFactoryList = Objects.requireNonNull(factoryBean.getObject());
        val contributors = new LinkedHashMap<>();
        ldaps.stream()
            .filter(LdapMonitorProperties::isEnabled)
            .map(Unchecked.function(ldap -> {
                val executor = Beans.newThreadPoolExecutorFactoryBean(ldap.getPool());
                val connectionFactory = LdapUtils.newLdaptivePooledConnectionFactory(ldap);
                connectionFactoryList.add(connectionFactory);
                val healthIndicator = new PooledLdapConnectionFactoryHealthIndicator(Beans.newDuration(ldap.getMaxWait()).toMillis(),
                    connectionFactory, executor.getObject(), new SearchConnectionValidator());
                val name = StringUtils.defaultIfBlank(ldap.getName(), UUID.randomUUID().toString());
                return Pair.of(name, healthIndicator);
            }))
            .forEach(it -> contributors.put(it.getKey(), it.getValue()));
        return CompositeHealthContributor.fromMap((Map) contributors);
    }
This is {@link CasLdapMonitorAutoConfiguration}.

@author Misagh Moayyed
@since 5.0.0
support/cas-server-support-ldap-monitor/src/main/java/org/apereo/cas/config/CasLdapMonitorAutoConfiguration.java