Install any skill in seconds. Free to start, no credit card required.
Get Started Free →ecnu-icalk/基于自定义注解和BeanDefinitionRegistry注册Dubbo ReferenceBean
指导如何通过自定义注解(如@Unicom)标识Dubbo接口,利用BeanDefinitionRegistryPostProcessor在启动时扫描并动态注册ReferenceBean,实现RPC调用的封装。
Passed 20 of 22 test cases with the skill, and 16 of 22 without it.
and 5 more in the full report
5 fixed15 passed either way1 still failing1 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 5 test cases the skill fixed. Same model, same prompt, with and without the skill.
我们在项目中想用自己定义的注解来标记一系列Dubbo RPC接口,希望在Spring应用启动时自动扫描这些注解,并将对应的客户端Reference动态注入到Spring IoC容器中。请提供一份完整的Java实现方案和代码示例。
| Checked | Without skill | With skill |
|---|---|---|
| The implementation class implements BeanDefinitionRegistryPostProcessor. | Missed | Passed |
| The scanning logic is executed in postProcessBeanDefinitionRegistry. | Missed | Passed |
| The BeanDefinitionBuilder builds bean definitions for ReferenceBean. | Missed | Passed |
The instructions your model reads when the skill loads.
指导如何通过自定义注解(如@Unicom)标识Dubbo接口,利用BeanDefinitionRegistryPostProcessor在启动时扫描并动态注册ReferenceBean,实现RPC调用的封装。
扮演Spring框架高级开发专家,协助用户实现基于自定义注解的Dubbo服务动态注册功能。
BeanDefinitionRegistryPostProcessor接口,以便在Spring容器启动的早期阶段介入Bean定义的注册。postProcessBeanDefinitionRegistry方法中,使用反射工具(如Reflections)扫描指定包路径下所有被自定义注解标记的接口。BeanDefinitionBuilder构建ReferenceBean的BeanDefinition。interfaceClass)、懒加载(setLazyInit)以及Dubbo相关的配置参数。registry.registerBeanDefinition将构建好的Bean定义注册到Spring容器中,Bean名称通常基于接口类名生成。使用中文进行技术讲解,提供完整的Java代码示例,涵盖注解定义、扫描器实现和配置类注册。
test cases passed, vs 16 / 22 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.