lj-example opened a new issue #9656: URL: https://github.com/apache/dubbo/issues/9656
<!-- If you need to report a security issue please visit https://github.com/apache/dubbo/security/policy --> - [ ] I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate. ### Environment * Dubbo version: 2.7.8 * Operating System version: mac * Java version: jdk8 ### Steps to reproduce this issue 1. dubbo-spring-boot-starter 集成 spring-boot 2.4.13 2. 自定义 Filter 中通过 set 的方式注入 springBean 会出现注入失败的情况 ``` java @Slf4j @Configuration @RequiredArgsConstructor @Activate(order = Ordered.LOWEST_PRECEDENCE) public class ProviderLogFilter implements Filter { private CrmProviderConfig providerConfig; public void setProviderConfig(CrmProviderConfig providerConfig) { this.providerConfig = providerConfig; } } ``` 3. 在 2.7.3 版本没有问题,经过查阅代码发现在 BeanFactoryUtils 中 ``` // Issue : https://github.com/alibaba/spring-context-support/issues/20 String[] allBeanNames = beanNamesForTypeIncludingAncestors(beanFactory, beanType, true, false); // 此处的返回的 beanNames 与实际的 beanName 不一致,导致 containsElement 判断失败,不会执行 set方法。 // 实际的beanName 为 `providerConfig` ,通过如上方式获取的 beanName 为`spring.dubbo.provider-xxx.xxx.config.CrmProviderConfig` List<T> beans = new ArrayList<T>(beanNames.length); for (String beanName : beanNames) { if (containsElement(allBeanNames, beanName)) { beans.add(beanFactory.getBean(beanName, beanType)); } } ``` Pls. provide [GitHub address] to reproduce this issue. ### Expected Behavior 不是很理解 ` if (containsElement(allBeanNames, beanName)) ` 判断的原因 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
