public interface GenId<T>
在 Spring 集成环境中,可以通过配置静态方式获取 Spring 的 context 对象。
如果使用 vesta(https://gitee.com/free/vesta-id-generator) 来生成 ID,假设已经提供了 vesta 的 idService。
那么可以在实现中获取该类,然后生成 Id 返回,示例代码如下:
public class VestaGenId implement GenId{ public Long genId(String table, String column){ //ApplicationUtil.getBean 需要自己实现 IdService idService = ApplicationUtil.getBean(IdService.class); return idService.genId(); } }
| Modifier and Type | Interface and Description |
|---|---|
static class |
GenId.NULL |
| Modifier and Type | Method and Description |
|---|---|
T |
genId(String table,
String column) |
Copyright © 2024. All rights reserved.