Class SnowflakeIdBeanDefinitionRegistrar

java.lang.Object
me.ahoo.cosid.spring.boot.starter.snowflake.SnowflakeIdBeanDefinitionRegistrar
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.config.BeanFactoryPostProcessor, org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor, org.springframework.context.EnvironmentAware

public class SnowflakeIdBeanDefinitionRegistrar extends Object implements org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor, org.springframework.context.EnvironmentAware
Registers a bean definition per snowflake id of cosid.snowflake.share and cosid.snowflake.provider, named {name}SnowflakeId: other beans can depend on them (@DependsOn("orderSnowflakeId")).

It only reads the id names from the environment and instantiates nothing. Each bean definition is the factory method SnowflakeIdBeanRegistrar.createBean(String) of the SnowflakeIdBeanRegistrar.BEAN_NAME bean, which runs the CustomizeSnowflakeIdProperties in the normal bean lifecycle. Ids a customizer adds have no bean definition: they are only registered in the IdGeneratorProvider.

Since:
4.0.0
  • Constructor Details

    • SnowflakeIdBeanDefinitionRegistrar

      public SnowflakeIdBeanDefinitionRegistrar()
  • Method Details

    • setEnvironment

      public void setEnvironment(org.springframework.core.env.Environment environment)
      Specified by:
      setEnvironment in interface org.springframework.context.EnvironmentAware
    • postProcessBeanDefinitionRegistry

      public void postProcessBeanDefinitionRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)
      Specified by:
      postProcessBeanDefinitionRegistry in interface org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor
    • postProcessBeanFactory

      public void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
      Specified by:
      postProcessBeanFactory in interface org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor
      Specified by:
      postProcessBeanFactory in interface org.springframework.beans.factory.config.BeanFactoryPostProcessor