All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zodiac.autoconfigure.internal.InternalAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.autoconfigure.internal;

import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
import org.springframework.context.annotation.Bean;
import org.zodiac.autoconfigure.bootstrap.condition.ConditionalOnAppDiscoveryEnabled;
import org.zodiac.core.application.AppContext;
import org.zodiac.core.bootstrap.discovery.AppDiscoveryClient;
import org.zodiac.core.internal.http.AppInternalHttpClient;

@SpringBootConfiguration
@ConditionalOnAppDiscoveryEnabled
@ConditionalOnWebApplication(type = Type.SERVLET)
@ConditionalOnClass(value = {org.springframework.web.client.RestTemplate.class})
public class InternalAutoConfiguration {

    public InternalAutoConfiguration() {
        super();
    }

    @Bean
    @ConditionalOnMissingBean
    protected AppInternalHttpClient internalHttpClient(AppDiscoveryClient discoveryClient, AppContext appContext,
        ObjectProvider restTemplateProvider) {
        return new AppInternalHttpClient(discoveryClient, appContext, restTemplateProvider.getIfAvailable());
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy