Class CosIdGeneratorRegistrar
java.lang.Object
me.ahoo.cosid.spring.autoconfigure.CosIdGeneratorRegistrar
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.config.BeanFactoryPostProcessor,org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor,org.springframework.context.EnvironmentAware
public class CosIdGeneratorRegistrar
extends Object
implements org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor, org.springframework.context.EnvironmentAware, org.springframework.beans.factory.BeanFactoryAware
Registers one bean per generator, named after it, whose instance
CosIdRuntime provides (07 ยง4.1): the runtime
stays the one source of truth. Only names and types are registered here, while the bean definitions are processed;
the spec is built then from cosid.* and the RuntimeSpecCustomizer beans, and is the
cosIdRuntimeSpec bean the runtime starts from.
Bean types: IdGenerator for snowflake, segment and custom (the default one
is primary), PartsIdGenerator for cosid80, GroupedIdGenerator for periodic-segment, and
the concrete UuidV7Generator for uuidv7, which has no interface of its own; the other concrete
generators are CosIdRuntime.get(name, type). The bean of a disabled generator throws
GeneratorDisabledException on each call (D24). Every generator bean depends on the runtime, so it is
destroyed before the runtime closes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThe bean of one generator: the runtime's view of it by the bean type, which counts the ids whencosid.metrics.generated.enabledis on. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidpostProcessBeanDefinitionRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry) voidpostProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) voidsetBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) voidsetEnvironment(org.springframework.core.env.Environment environment) me.ahoo.cosid.runtime.RuntimeSpecspec()The spec:cosid.*mapped byCosIdSpecs, then customized.
-
Field Details
-
RUNTIME_BEAN
- See Also:
-
SPEC_BEAN
- See Also:
-
-
Constructor Details
-
CosIdGeneratorRegistrar
public CosIdGeneratorRegistrar()
-
-
Method Details
-
setEnvironment
public void setEnvironment(org.springframework.core.env.Environment environment) - Specified by:
setEnvironmentin interfaceorg.springframework.context.EnvironmentAware
-
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) - Specified by:
setBeanFactoryin interfaceorg.springframework.beans.factory.BeanFactoryAware
-
spec
public me.ahoo.cosid.runtime.RuntimeSpec spec()The spec:cosid.*mapped byCosIdSpecs, then customized. Built once.- Returns:
- the spec
-
postProcessBeanDefinitionRegistry
public void postProcessBeanDefinitionRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry) throws org.springframework.beans.BeansException - Specified by:
postProcessBeanDefinitionRegistryin interfaceorg.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor- Throws:
org.springframework.beans.BeansException
-
postProcessBeanFactory
public void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) throws org.springframework.beans.BeansException - Specified by:
postProcessBeanFactoryin interfaceorg.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor- Specified by:
postProcessBeanFactoryin interfaceorg.springframework.beans.factory.config.BeanFactoryPostProcessor- Throws:
org.springframework.beans.BeansException
-