1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

fix duplicate sentinel interceptor registration

This commit is contained in:
fangjian0423
2019-03-18 22:53:39 +08:00
parent fc724a5056
commit 3f15f7388b
2 changed files with 33 additions and 4 deletions

View File

@@ -85,6 +85,11 @@ public class SentinelRestTemplateTests {
new AnnotationConfigApplicationContext(TestConfig9.class);
}
@Test
public void testNormalWithoutParam() {
new AnnotationConfigApplicationContext(TestConfig10.class);
}
@Configuration
public static class TestConfig1 {
@Bean
@@ -220,6 +225,27 @@ public class SentinelRestTemplateTests {
}
}
@Configuration
public static class TestConfig10 {
@Bean
SentinelBeanPostProcessor sentinelBeanPostProcessor(
ApplicationContext applicationContext) {
return new SentinelBeanPostProcessor(applicationContext);
}
@Bean
@SentinelRestTemplate
RestTemplate restTemplate() {
return new RestTemplate();
}
@Bean
@SentinelRestTemplate
RestTemplate restTemplate2() {
return new RestTemplate();
}
}
public static class ExceptionUtil {
public static SentinelClientHttpResponse handleException(HttpRequest request,
byte[] body, ClientHttpRequestExecution execution, BlockException ex) {