入口
@EnableCircuitBreaker 这注解也能开启Hystrix的相关功能
复制代码
其中读取spring.factories哪个文件的入口在此 org.springframework.cloud.commons.util.SpringFactoryImportSelector#selectImports
public String[] selectImports(AnnotationMetadata metadata) {
if (!isEnabled()) {
return new String[0];
}
AnnotationAttributes attributes = AnnotationAttributes.fromMap(
metadata.getAnnotationAttributes(this.annotationClass.getName(), true));
Assert.notNull(attributes, "No " + getSimpleName() + " attributes found. Is "
+ metadata.getClassName() + " annotated with @" + getSimpleName() + "?");
// 因为是EnableCircuitBreaker这个注解读取的是META-INF/spring.factories 中org.springframework.cloud.netflix.hystrix.HystrixCircuitBreakerConfiguration 这个配置
List<String> factories = new ArrayList<>(new LinkedHashSet<>