@Bean
    public AbstractDiscoveryClientOptionalArgs restClientDiscoveryClientOptionalArgs(
        final TlsProperties tlsProperties, final RestTemplateTimeoutProperties restTemplateTimeoutProperties,
        @Qualifier(CasSSLContext.BEAN_NAME) final CasSSLContext casSslContext,
        final ObjectProvider<RestClient.Builder> restClientBuilderProvider) throws Exception {
        val factorySupplier = new DefaultEurekaClientHttpRequestFactorySupplier(restTemplateTimeoutProperties);
        val result = new RestClientDiscoveryClientOptionalArgs(factorySupplier,
            () -> restClientBuilderProvider.getIfAvailable(RestClient::builder));

        if (tlsProperties.isEnabled()) {
            val factory = new SSLContextFactory(tlsProperties);
            result.setSSLContext(factory.createSSLContext());
        } else {
            result.setSSLContext(casSslContext.getSslContext());
            result.setHostnameVerifier(casSslContext.getHostnameVerifier());
        }
        return result;
    }
This is {@link CasEurekaDiscoveryClientAutoConfiguration}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-eureka-client/src/main/java/org/apereo/cas/config/CasEurekaDiscoveryClientAutoConfiguration.java