org.zodiac.autoconfigure.nacos.confcenter.NacosConfCenterBeanDefinitionRegistrar Maven / Gradle / Ivy
package org.zodiac.autoconfigure.nacos.confcenter;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;
@SpringBootConfiguration
@ConditionalOnClass(name = {"org.zodiac.nacos.config.confcenter.NacosConfCenterInfo"})
@ConditionalOnProperty(name = org.zodiac.nacos.base.constants.NacosSystemPropertiesConstants.NACOS_CONFIG_ENABLED, havingValue = "true")
public class NacosConfCenterBeanDefinitionRegistrar implements ImportBeanDefinitionRegistrar, BeanFactoryAware {
public NacosConfCenterBeanDefinitionRegistrar() {
}
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
DefaultListableBeanFactory defaultListableBeanFactory = (DefaultListableBeanFactory)beanFactory;
BeanDefinitionBuilder beanDefinitionBuilder =
BeanDefinitionBuilder.rootBeanDefinition(org.zodiac.nacos.client.confcenter.binder.NacosBootConfigurationPropertiesBinder.class);
defaultListableBeanFactory.registerBeanDefinition(org.zodiac.nacos.client.confcenter.binder.NacosBootConfigurationPropertiesBinder.BEAN_NAME,
beanDefinitionBuilder.getBeanDefinition());
}
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy