renxue
2022-10-24 0b055a3f554da3a934e79e88c4781705cbab5a21
提交 | 用户 | age
0b055a 1 package com.hz.canal.starter.configuration;
R 2
3 import org.springframework.beans.factory.support.BeanDefinitionRegistry;
4 import org.springframework.beans.factory.support.RootBeanDefinition;
5 import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
6 import org.springframework.core.type.AnnotationMetadata;
7
8 /**
9  * @author wuqiong 2022/4/12
10  */
11 public class CanalBootstrapConfiguration implements ImportBeanDefinitionRegistrar {
12
13     public static final String CANAL_LISTENER_ANNOTATION_PROCESSOR_BEAN_NAME =
14             "com.duxinglangzi.canal.starter.configuration.CanalListenerAnnotationBeanPostProcessor";
15
16     /**
17      * 注册 CanalListenerAnnotationBeanPostProcessor 到spring bean 容器内
18      *
19      * @param importingClassMetadata
20      * @param registry
21      * @return void
22      * @author wuqiong 2022-04-23 20:21
23      */
24     @Override
25     public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
26         if (!registry.containsBeanDefinition(CANAL_LISTENER_ANNOTATION_PROCESSOR_BEAN_NAME)) {
27
28             registry.registerBeanDefinition(CANAL_LISTENER_ANNOTATION_PROCESSOR_BEAN_NAME,
29                     new RootBeanDefinition(CanalListenerAnnotationBeanPostProcessor.class));
30         }
31
32
33     }
34
35 }