Class SegmentIdBeanDefinitionRegistrar

java.lang.Object
me.ahoo.cosid.spring.boot.starter.segment.SegmentIdBeanDefinitionRegistrar
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 SegmentIdBeanDefinitionRegistrar extends Object implements org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor, org.springframework.context.EnvironmentAware
Registers a bean definition per segment id of cosid.segment.share and cosid.segment.provider, named {name}SegmentId: other beans can depend on them (@DependsOn("orderSegmentId")), and the context closes them on shutdown, which stops a segment chain's background prefetch.

It only reads the id names from the environment and instantiates nothing. Each bean definition is the factory method SegmentIdBeanRegistrar.createBean(String) of the SegmentIdBeanRegistrar.BEAN_NAME bean, which runs the CustomizeSegmentIdProperties 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

    • SegmentIdBeanDefinitionRegistrar

      public SegmentIdBeanDefinitionRegistrar()
  • 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