From 729dc0c007e2ccdc62c1d84329cc00d81f3e32f7 Mon Sep 17 00:00:00 2001 From: RuanSheng Date: Sun, 11 Jun 2023 22:32:58 +0800 Subject: [PATCH] Fix: SentinelRestTemplate support custom RestTemplate (#3329) (#3344) --- .../cloud/sentinel/custom/SentinelBeanPostProcessor.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-sentinel/src/main/java/com/alibaba/cloud/sentinel/custom/SentinelBeanPostProcessor.java b/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-sentinel/src/main/java/com/alibaba/cloud/sentinel/custom/SentinelBeanPostProcessor.java index 70387cd0b..17508e39f 100644 --- a/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-sentinel/src/main/java/com/alibaba/cloud/sentinel/custom/SentinelBeanPostProcessor.java +++ b/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-sentinel/src/main/java/com/alibaba/cloud/sentinel/custom/SentinelBeanPostProcessor.java @@ -167,7 +167,8 @@ public class SentinelBeanPostProcessor implements MergedBeanDefinitionPostProces private boolean checkSentinelProtect(RootBeanDefinition beanDefinition, Class beanType, String beanName) { - return beanName != null && beanType == RestTemplate.class + // Fixes #3329: Support custom RestTemplate + return beanName != null && RestTemplate.class.isAssignableFrom(beanType) && checkMethodMetadataReadingVisitor(beanDefinition); }