赞
踩
- @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<>(
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。