Files
onixbyte-bom/identity-generator
siujamo 54e11c9b8b refactor(build): decouple per-module versioning
Each module uses its own version property instead of a shared
artefactVersion, so changes to one module no longer force a
version bump across all modules. CI now supports per-module
release tags with the format <module>/v<version>.
2026-05-29 16:20:27 +08:00
..
2025-06-17 16:32:57 +08:00

Module guid

Introduction

Module guid serves as a guid creator for other JDevKit modules. You can also use this module as a guid creator standards.

We have already implemented SnowflakeGuidCreator, you can also implement a custom guid creations by implementing com.onixbyte.identitygenerator.IdentityGenerator.

Example usage

A UUID creator

GuidCreator<UUID> uuidCreator = (GuidCreator<UUID>) UUID::randomUUID;

A custom guid creator

Assume that you need serial guid creator.

@Component
public class CustomGuidCreator implementes GuidCreator<String> {
    
    public final RedisTemplate<String, Long> serialRedisTemplate;
    
    @Autowired
    public CustomGuidCreator(RedisTemplate<String, Long> serialRedisTemplate) {
        this.serialRedisTemplate = serialRedisTemplate;
    }
    
    @Override public String nextId() {
        return "SOME_PREFIX" + serialRedisTemplate.opsForValue().get("some_serial_key");
    }
    
}