Flowable扩展id生成规则
1. maven项目依赖2. 扩展IdGenerator实现类org.flowable flowable-spring-boot-starter-process6.7.2
public class CustomIdGenerator implements IdGenerator {
protected static volatile TimebasedGenerator timebasedGenerator;
public CustomIdGenerator() {
ensureGeneratorInitialized();
}
protected void ensureGeneratorInitialized() {
if (timebasedGenerator == null) {
synchronized (StrongUuidGenerator.class) {
if (timebasedGenerator == null) {
timebasedGenerator = Generators.timebasedGenerator(EthernetAddress.fromInterface());
}
}
}
}
@Override
public String getNextId() {
return timebasedGenerator.generate().toString().replaceAll("-", "");
}
}
3. 配置IdGenerator到EngineConfigurationConfigurer
@Slf4j
@Configuration
public class FlowableConfig {
@Bean
public EngineConfigurationConfigurer engineConfigurationConfigurer() {
return engineConfiguration -> {
engineConfiguration.setIdGenerator(new CustomIdGenerator());
};
}
}
4.项目完整地址
Flowable自定义IdGenerator Github 地址
Flowable自定义IdGenerator Gitee 地址



