org.zodiac.autoconfigure.feign.ServletFeignContextConfiguration Maven / Gradle / Ivy
package org.zodiac.autoconfigure.feign;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Qualifier;
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.springframework.core.convert.ConversionService;
import org.zodiac.autoconfigure.feign.condition.ConditionalOnFeignConsumerEnabled;
@SpringBootConfiguration
@ConditionalOnFeignConsumerEnabled
@ConditionalOnWebApplication(type = Type.SERVLET)
@ConditionalOnClass(value = {feign.Client.class, org.zodiac.feign.core.FeignConsumerClientProvider.class})
class ServletFeignContextConfiguration {
public ServletFeignContextConfiguration() {
super();
}
@Bean
@ConditionalOnMissingBean
protected org.zodiac.feign.core.config.ServletFeignContextConfigurer servletFeignContextConfigurer() {
return new org.zodiac.feign.core.config.ServletFeignContextConfigurer();
}
@Bean
@ConditionalOnMissingBean
protected feign.RequestInterceptor requestInterceptor(org.zodiac.feign.core.config.ServletFeignContextConfigurer servletFeignContextConfigurer) {
return servletFeignContextConfigurer.requestInterceptor();
}
@Bean
@ConditionalOnMissingBean
protected org.zodiac.feign.core.context.internal.ProviderFeignContextFilter cloudProviderFeignContextFilter(org.zodiac.feign.core.config.ServletFeignContextConfigurer servletFeignContextConfigurer) {
return servletFeignContextConfigurer.cloudProviderFeignContextFilter();
}
@Bean(value = org.zodiac.feign.core.constants.FeignConsumerConstants.BEAN_SPRING_WEBMVC_CONTRACT)
@ConditionalOnMissingBean
protected org.zodiac.feign.core.annotation.mvc.SpringMvcContract springMvcContract(org.zodiac.feign.core.config.ServletFeignContextConfigurer servletFeignContextConfigurer,
@Qualifier("mvcConversionService") ObjectProvider objectProvider) {
return servletFeignContextConfigurer.springMvcContract(objectProvider);
}
}