utils-toolkit
Installation
SKILL.md
后端工具类大全
快速索引
| 功能 | 推荐方案 | 备选方案 | 常用方法 |
|---|---|---|---|
| 对象转换 | [你的对象转换工具] |
MapStruct / BeanUtils / ModelMapper | convert() / copyProperties() |
| 字符串 | Hutool StrUtil |
Apache Commons StringUtils / Guava Strings |
isBlank(), format() |
| 集合/流 | Hutool CollUtil + Java Stream |
Guava Collections2 |
isEmpty(), filter(), toList() |
| 树结构 | Hutool TreeUtil |
自定义递归构建 | build() |
| 日期时间 | java.time API |
Hutool DateUtil |
LocalDateTime.now(), format() |
| 参数校验 | Jakarta Validation | Hutool Validator |
@NotNull, @NotBlank |
| JSON | Jackson ObjectMapper |
Gson / Hutool JSONUtil |
toJsonString(), parseObject() |
| 业务异常 | [你的异常类] |
自定义 RuntimeException | throw new [YourException]() |
| 登录用户 | [你的用户上下文工具] |
SecurityContextHolder / 自定义 ThreadLocal | getUserId(), getUsername() |
| Spring容器 | ApplicationContext |
自定义 SpringUtils |
getBean() |
Related skills