org.zodiac.autoconfigure.feign.NettyFeignConsumerConfiguration Maven / Gradle / Ivy
package org.zodiac.autoconfigure.feign;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.zodiac.autoconfigure.feign.condition.ConditionalOnFeignConsumerEnabled;
import org.zodiac.autoconfigure.feign.condition.ConditionalOnFeignNettyEnabled;
@SpringBootConfiguration
@ConditionalOnFeignConsumerEnabled
@ConditionalOnFeignNettyEnabled
@ConditionalOnClass(value = {feign.Client.class, org.zodiac.feign.core.FeignConsumerClientProvider.class, org.zodiac.feign.netty.NettyFeignClient.class, org.zodiac.client.netty.http.NettyHttpClient.class, org.zodiac.netty.http.headers.Headers.class, org.zodiac.sdk.toolkit.marshallers.Marshaller.class})
@ConditionalOnExpression(value = "'" + org.zodiac.feign.core.constants.FeignConstants.CLIENT_PROVIDER_NETTY + "'.equalsIgnoreCase('${" + org.zodiac.feign.core.constants.FeignSystemPropertiesConstants.FEIGN_CLIENT_CONSUMER_PROVIDER + ":" + org.zodiac.feign.core.constants.FeignConstants.CLIENT_PROVIDER_NETTY + "}')")
public class NettyFeignConsumerConfiguration {
private FeignConsumerProperties feignConsumerProperties;
public NettyFeignConsumerConfiguration(FeignConsumerProperties feignConsumerProperties) {
this.feignConsumerProperties = feignConsumerProperties;
}
@Bean
@ConditionalOnMissingBean
protected org.zodiac.feign.netty.config.NettyFeignConsumerConfigurer nettyFeignConsumerConfigurer() {
return new org.zodiac.feign.netty.config.NettyFeignConsumerConfigurer(feignConsumerProperties);
}
@ConditionalOnMissingBean
@Bean(name = org.zodiac.feign.core.constants.FeignConsumerConstants.BEAN_FEIGN_CLIENT)
protected feign.Client nettyFeignClient(org.zodiac.feign.netty.config.NettyFeignConsumerConfigurer nettyFeignConsumerConfigurer) {
return nettyFeignConsumerConfigurer.nettyFeignClient();
}
}