Class SnowflakeIdBeanRegistrar

java.lang.Object
me.ahoo.cosid.spring.boot.starter.snowflake.SnowflakeIdBeanRegistrar
All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean

public class SnowflakeIdBeanRegistrar extends Object implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
  • Field Details

    • BEAN_NAME

      public static final String BEAN_NAME
      The bean name, the factory bean of the {name}SnowflakeId bean definitions.
      See Also:
  • Constructor Details

  • Method Details

    • beanName

      public static String beanName(String name)
      The bean name of the snowflake id name.
    • definitions

      The snowflake ids of the properties: the share, when enabled, and the named ones.
    • createBean

      public SnowflakeId createBean(String name)
      The factory method of the {name}SnowflakeId beans.
    • afterPropertiesSet

      public void afterPropertiesSet()
      Snowflake ids a customizer added have no bean definition: they are only registered in the provider, here.
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • destroy

      public void destroy()
      Remove the ids from the provider, where it still holds them, so a later context does not get ids of this one, whose machine ids are released.
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
    • create

      public SnowflakeId create(String name, SnowflakeIdProperties.IdDefinition idDefinition)
      Create the snowflake id name and register it in the IdGeneratorProvider unless one is there.