diff --git a/documentation/docs/guide/getting-started.md b/documentation/docs/guide/getting-started.md index fff2a52aa4..775a4db367 100644 --- a/documentation/docs/guide/getting-started.md +++ b/documentation/docs/guide/getting-started.md @@ -121,18 +121,16 @@ cosid: @Resource IdGeneratorProvider provider; @Resource - StringRedisTemplate stringRedisTemplate; - - public void createProvider(String idName) { - SpringRedisIdSegmentDistributor springRedisIdSegmentDistributor = new SpringRedisIdSegmentDistributor("namespace", "idName", stringRedisTemplate); - SegmentChainId segmentId = new SegmentChainId(springRedisIdSegmentDistributor); + IdSegmentDistributorFactory idSegmentDistributorFactory; + public void createIdGenerator(String idName) { + IdSegmentDistributorDefinition definition = new IdSegmentDistributorDefinition("namespace", "idName",0,100); + IdSegmentDistributor idSegmentDistributor = idSegmentDistributorFactory.create(definition); + SegmentChainId segmentId = new SegmentChainId(idSegmentDistributor); provider.set(idName, segmentId); } ``` - - ## Examples 开发者可以通过 [CosId-Examples](https://github.com/Ahoo-Wang/CosId/tree/main/examples) 的学习快速开启 `CosId` 之旅。