id-generator-spring-boot-autoconfigure

a spring boot starter for id generator

License

License

Categories

Categories

Spring Boot Container Microservices Auto Application Layer Libs Code Generators config Configuration
GroupId

GroupId

xin.yuki
ArtifactId

ArtifactId

id-generator-spring-boot-autoconfigure
Last Version

Last Version

2.3-2
Release Date

Release Date

Type

Type

jar
Description

Description

id-generator-spring-boot-autoconfigure
a spring boot starter for id generator

Download id-generator-spring-boot-autoconfigure

How to add to project

<!-- https://jarcasting.com/artifacts/xin.yuki/id-generator-spring-boot-autoconfigure/ -->
<dependency>
    <groupId>xin.yuki</groupId>
    <artifactId>id-generator-spring-boot-autoconfigure</artifactId>
    <version>2.3-2</version>
</dependency>
// https://jarcasting.com/artifacts/xin.yuki/id-generator-spring-boot-autoconfigure/
implementation 'xin.yuki:id-generator-spring-boot-autoconfigure:2.3-2'
// https://jarcasting.com/artifacts/xin.yuki/id-generator-spring-boot-autoconfigure/
implementation ("xin.yuki:id-generator-spring-boot-autoconfigure:2.3-2")
'xin.yuki:id-generator-spring-boot-autoconfigure:jar:2.3-2'
<dependency org="xin.yuki" name="id-generator-spring-boot-autoconfigure" rev="2.3-2">
  <artifact name="id-generator-spring-boot-autoconfigure" type="jar" />
</dependency>
@Grapes(
@Grab(group='xin.yuki', module='id-generator-spring-boot-autoconfigure', version='2.3-2')
)
libraryDependencies += "xin.yuki" % "id-generator-spring-boot-autoconfigure" % "2.3-2"
[xin.yuki/id-generator-spring-boot-autoconfigure "2.3-2"]

Dependencies

compile (5)

Group / Artifact Type Version
org.springframework.boot : spring-boot-autoconfigure jar
org.springframework.boot : spring-boot-configuration-processor Optional jar
xin.yuki : id-generator-interface jar 2.3
xin.yuki : id-generator-core jar 2.3
org.projectlombok : lombok Optional jar 1.18.2

test (1)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-test jar

Project Modules

There are no modules declared in this project.

id-generator

基于Twitter的SnowFlake算法实现的高性能分布式ID发号器。支持手动或通过Zookeeper分配workerId。配置简单,操作简易。生成的id具备全局唯一,粗略有序,可反向解码等特性。

实现

基于Gitee lxm23/id-generator,发布了spring-boot-starter版本,并上传至中央仓库

使用方式

引入依赖:

<dependency>
      <groupId>xin.yuki</groupId>
      <artifactId>id-generator-spring-boot-starter</artifactId>
      <version>2.3</version>
</dependency>

使用IdService:


import com.lxm.idgenerator.service.intf.IdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class ServerSampleApplication {


    @Autowired
    private IdService idService;

    public static void main(final String[] args) {
        SpringApplication.run(ServerSampleApplication.class, args);
    }

    public Long getId(){
        return this.idService.genId();
    }
}

配置参考

请参考原项目配置

Versions

Version
2.3-2
2.3-1
2.3