duxinglangzi
2022-04-23 6274208525b7e80c208f614915ef973d63834101
提交 | 用户 | age
de8c2b 1 package com.duxinglangzi.canal.starter.configuration;
D 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
627420 16     /**
D 17      * 注册 CanalListenerAnnotationBeanPostProcessor 到spring bean 容器内
18      * @param importingClassMetadata
19      * @param registry
20      * @return void
21      * @author wuqiong 2022-04-23 20:21
22      */
de8c2b 23     @Override
D 24     public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
25         if (!registry.containsBeanDefinition(CANAL_LISTENER_ANNOTATION_PROCESSOR_BEAN_NAME)) {
26
27             registry.registerBeanDefinition(CANAL_LISTENER_ANNOTATION_PROCESSOR_BEAN_NAME,
28                     new RootBeanDefinition(CanalListenerAnnotationBeanPostProcessor.class));
29         }
30
31
32     }
33
34 }