duxinglangzi
2022-05-16 7cf9781edf66c75570af378a96b4011ff63ada92
提交 | 用户 | 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 容器内
7cf978 18      *
627420 19      * @param importingClassMetadata
D 20      * @param registry
21      * @return void
22      * @author wuqiong 2022-04-23 20:21
23      */
de8c2b 24     @Override
D 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 }