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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSnowflakeIdBeanRegistrar(CosIdProperties cosIdProperties, MachineProperties machineProperties, SnowflakeIdProperties snowflakeIdProperties, InstanceId instanceId, IdGeneratorProvider idGeneratorProvider, GuardDistribute guardDistribute, ClockBackwardsSynchronizer clockBackwardsSynchronizer, org.springframework.beans.factory.ObjectProvider<CustomizeSnowflakeIdProperties> customizers, @Nullable org.springframework.beans.factory.support.BeanDefinitionRegistry beanDefinitions) Create the factory of the snowflake ids: runs everyCustomizeSnowflakeIdPropertieson the properties first. -
Method Summary
Modifier and TypeMethodDescriptionvoidSnowflake ids a customizer added have no bean definition: they are only registered in the provider, here.static StringThe bean name of the snowflake idname.create(String name, SnowflakeIdProperties.IdDefinition idDefinition) Create the snowflake idnameand register it in theIdGeneratorProviderunless one is there.createBean(String name) The factory method of the{name}SnowflakeIdbeans.The snowflake ids of the properties: the share, when enabled, and the named ones.voiddestroy()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.
-
Field Details
-
BEAN_NAME
The bean name, the factory bean of the{name}SnowflakeIdbean definitions.- See Also:
-
-
Constructor Details
-
SnowflakeIdBeanRegistrar
public SnowflakeIdBeanRegistrar(CosIdProperties cosIdProperties, MachineProperties machineProperties, SnowflakeIdProperties snowflakeIdProperties, InstanceId instanceId, IdGeneratorProvider idGeneratorProvider, GuardDistribute guardDistribute, ClockBackwardsSynchronizer clockBackwardsSynchronizer, org.springframework.beans.factory.ObjectProvider<CustomizeSnowflakeIdProperties> customizers, @Nullable org.springframework.beans.factory.support.BeanDefinitionRegistry beanDefinitions) Create the factory of the snowflake ids: runs everyCustomizeSnowflakeIdPropertieson the properties first.- Parameters:
beanDefinitions- the registry of the{name}SnowflakeIdbean definitions,nullfor none
-
-
Method Details
-
beanName
The bean name of the snowflake idname. -
definitions
The snowflake ids of the properties: the share, when enabled, and the named ones. -
createBean
The factory method of the{name}SnowflakeIdbeans. -
afterPropertiesSet
public void afterPropertiesSet()Snowflake ids a customizer added have no bean definition: they are only registered in the provider, here.- Specified by:
afterPropertiesSetin interfaceorg.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:
destroyin interfaceorg.springframework.beans.factory.DisposableBean
-
create
Create the snowflake idnameand register it in theIdGeneratorProviderunless one is there.
-