Class UuidIdGenerator

java.lang.Object
io.github.xezzon.zeroweb.common.jpa.UuidIdGenerator
All Implemented Interfaces:
IdGenerator

@Component @ConditionalOnProperty(prefix="zeroweb", name="id-generator", havingValue="UUID", matchIfMissing=true) public class UuidIdGenerator extends Object implements IdGenerator

基于 UUID 的 ID 生成器实现。

zeroweb.id-generator 配置属性设置为 "UUID" 或未设置时,此生成器将激活。 它使用 Generators.timeBasedEpochRandomGenerator() 生成基于时间戳的 UUID(UUIDv7),确保生成的 ID 具有唯一性和可排序性。

Author:
xezzon
  • Constructor Details

    • UuidIdGenerator

      public UuidIdGenerator()
  • Method Details

    • nextId

      public String nextId()
      生成下一个 UUID 字符串作为 ID。
      Specified by:
      nextId in interface IdGenerator
      Returns:
      新生成的 UUID 字符串