org.zodiac.autoconfigure.hystrix.ServletPlatformHystrixAutoConfiguration Maven / Gradle / Ivy
package org.zodiac.autoconfigure.hystrix;
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.annotation.Order;
import org.zodiac.autoconfigure.hystrix.condition.ConditionalOnFeignHystrixEnabled;
@SpringBootConfiguration
@ConditionalOnWebApplication(type = Type.SERVLET)
@ConditionalOnFeignHystrixEnabled
@ConditionalOnClass(value= {com.netflix.hystrix.Hystrix.class, feign.Feign.class, feign.hystrix.HystrixFeign.class, org.zodiac.hystrix.core.PlatformHystrixConcurrencyStrategy.class})
public class ServletPlatformHystrixAutoConfiguration {
public ServletPlatformHystrixAutoConfiguration() {
}
@Bean
@ConditionalOnMissingBean
protected org.zodiac.hystrix.core.config.ServletPlatformHystrixConfigurer servletPlatformHystrixConfigurer() {
return new org.zodiac.hystrix.core.config.ServletPlatformHystrixConfigurer();
}
@Bean
@Order(value = 0)
@ConditionalOnMissingBean
protected feign.RequestInterceptor requestInterceptor(org.zodiac.hystrix.core.config.ServletPlatformHystrixConfigurer servletPlatformHystrixConfigurer) {
return servletPlatformHystrixConfigurer.requestInterceptor();
}
}