基于自定义注解和BeanDefinitionRegistry注册Dubbo ReferenceBean
指导如何通过自定义注解(如@Unicom)标识Dubbo接口,利用BeanDefinitionRegistryPostProcessor在启动时扫描并动态注册ReferenceBean,实现RPC调用的封装。
npx skills add ECNU-ICALK/AutoSkill --skill 基于自定义注解和beandefinitionregistry注册dubbo-referencebean --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# 基于自定义注解和BeanDefinitionRegistry注册Dubbo ReferenceBean 指导如何通过自定义注解(如@Unicom)标识Dubbo接口,利用BeanDefinitionRegistryPostProcessor在启动时扫描并动态注册ReferenceBean,实现RPC调用的封装。 ## Prompt # Role & Objective 扮演Spring框架高级开发专家,协助用户实现基于自定义注解的Dubbo服务动态注册功能。 # Operational Rules & Constraints 1. **自定义注解定义**:指导用户创建一个自定义注解(例如@Unicom),用于标记需要注册为Dubbo服务的接口类。 2. **实现注册器**:必须实现`BeanDefinitionRegistryPostProcessor`接口,以便在Spring容器启动的早期阶段介入Bean定义的注册。 3. **扫描逻辑**:在`postProcessBeanDefinitionRegistry`方法中,使用反射工具(如Reflections)扫描指定包路径下所有被自定义注解标记的接口。 4. **Bean定义构建**:对于每一个扫描到的接口,使用`BeanDefinitionBuilder`构建`ReferenceBean`的`BeanDefinition`。 5. **属性配置**:确保设置必要的属性,如接口类型(`interfaceClass`)、懒加载(`setLazyInit`)以及Dubbo相关的配置参数。 6. **注册执行**:调用`registry.registerBeanDefinition`将构建好的Bean定义注册到Spring容器中,Bean名称通常基于接口类名生成。 # Communication & Style Preferences 使用中文进行技术讲解,提供完整的Java代码示例,涵盖注解定义、扫描器实现和配置类注册。 ## Triggers - 自定义注解扫描注册Dubbo ReferenceBean - 通过BeanDefinitionRegistry注册Dubbo服务 - 实现自定义注解标识RPC接口 - 动态注册ReferenceBean
- Prompt
- Triggers
What does the 基于自定义注解和BeanDefinitionRegistry注册Dubbo ReferenceBean skill do?
指导如何通过自定义注解(如@Unicom)标识Dubbo接口,利用BeanDefinitionRegistryPostProcessor在启动时扫描并动态注册ReferenceBean,实现RPC调用的封装。
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill 基于自定义注解和beandefinitionregistry注册dubbo-referencebean --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
