/**
* 该类实现的功能是在strongUuidGenerator基础上,去除类'-'
*/
@Component
public class CustomUuidGenerator implements IdGenerator {
protected static volatile TimeBasedGenerator timeBasedGenerator;
public CustomUuidGenerator() {
ensureGeneratorInitialized();
}
protected void ensureGeneratorInitialized() {
if (timeBasedGenerator == null) {
synchronized (StrongUuidGenerator.class) {
if (timeBasedGenerator == null) {
timeBasedGenerator = Generators.timeBasedGenerator(EthernetAddress.fromInterface());
}
}
}
}
@Override
public String getNextId() {
//自己有需要可以在这里返回自定义生成的ID
return timeBasedGenerator.generate().toString().replaceAll("-","");
}
}
Générateur d'ID personnalisé Camunda
おすすめ
転載: blog.csdn.net/qq_39517116/article/details/124213444
ランキング