Class SegmentIdBeanRegistrar

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

public class SegmentIdBeanRegistrar 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}SegmentId bean definitions.
      See Also:
  • Constructor Details

  • Method Details

    • beanName

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

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

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

      public void afterPropertiesSet()
      Segment 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() throws Exception
      Remove the ids from the provider, where it still holds them, so a later context does not get closed ones; close the ids that are not beans.
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
      Throws:
      Exception
    • create

      public SegmentId create(String name, SegmentIdProperties.IdDefinition idDefinition)
      Create the segment id name and register it in the IdGeneratorProvider unless one is there.