diff --git a/sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/ServiceBeanFactoryPostProcessor.java b/sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/ServiceBeanFactoryPostProcessor.java index 73515c9a9..bd5b44ec0 100644 --- a/sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/ServiceBeanFactoryPostProcessor.java +++ b/sofa-boot-project/sofa-boot-core/runtime-sofa-boot/src/main/java/com/alipay/sofa/runtime/spring/ServiceBeanFactoryPostProcessor.java @@ -44,6 +44,7 @@ import org.springframework.context.annotation.ScannedGenericBeanDefinition; import org.springframework.core.Ordered; import org.springframework.core.annotation.AnnotatedElementUtils; +import org.springframework.core.annotation.AnnotationUtils; import org.springframework.core.annotation.Order; import org.springframework.core.env.Environment; import org.springframework.core.type.MethodMetadata; @@ -259,7 +260,9 @@ private void doGenerateSofaReferenceDefinition(BeanDefinition beanDefinition, private void generateSofaServiceDefinitionOnClass(String beanId, Class beanClass, BeanDefinition beanDefinition, ConfigurableListableBeanFactory beanFactory) { - SofaService sofaServiceAnnotation = beanClass.getAnnotation(SofaService.class); + // See issue: https://github.com/sofastack/sofa-boot/issues/835 + SofaService sofaServiceAnnotation = AnnotationUtils.findAnnotation(beanClass, + SofaService.class); generateSofaServiceDefinition(beanId, sofaServiceAnnotation, beanClass, beanDefinition, beanFactory); }