下面是我的常用解决方案,主要想抛砖引玉,希望大佬们多多补充,拓宽下大伙的视野:
ORM:Mybaits 、Mybaits-plus 登录:JWT 、Session 安全:拦截器、Spring Security 缓存:Spring Cache 、Spring Data Redis 定时:Spring Task 异常:全局异常处理 结果:统一 Result 处理 工具集:hutool 、POI 网络通信:WebSocket 、HttpCilent 插件:lombook 日志:SLF4J 对象存储:Alioss
还遗漏哪些场景的工具,希望大佬们多多补充。
![]() |
1
uxstone 134 天前
单元测试
|
2
leo97 134 天前 via Android
ORM: spring data jpa + querydsl
|
3
0xGnaixEuy 133 天前 via iPhone
data jpa 两票
|
![]() |
4
tedzhou1221 133 天前
word 文档生成 :poi-tl
属性复制:mapstructs, reflectasm |
5
cslive 133 天前
ORM:spring data jpa
工具集:apache 全家桶 |
6
tairan2006 133 天前
http 客户端的话,只有 spring feign 比较好用,其他的都太繁琐;
Spring Security 设计的太复杂,不如自己写; 定时直接用 k8s cronjob 或者 xxljob ; |
7
limyel 133 天前
hutool ❌
guava ✅ |
8
hyqCrystal 133 天前
Spring Security=>sa-token
Alioss=>minio HttpCilent 插件=>feign/forest 微服务下可采用 dubbo Spring Task=>xxl-job |
9
loveaeen 133 天前
@hyqCrystal sa-token 一直听说,但是不知道实际用起来是否可靠
|
![]() |
10
knightdf 133 天前
Mybaits -> JOOQ
|
11
Ayanokouji 133 天前
语言:java-> kotlin
orm:ktorm |
12
uianz 133 天前
ORM: JOOQ
工具集: VAVR HttpCilent: Forest |
13
yule111222 133 天前
@Ayanokouji 赞!同道中人啊
|
![]() |
14
iosyyy 133 天前
你这标点符号不如不用..也太乱了
|
17
bitmin 133 天前
数据库查询用了 JPA 、JdbcTemplate ,写了工具增强功能,比如对象转 Specification 、根据查询参数删除 SQL 中不需要的查询语句
后台页面经常一堆查询条件,我先写完整的查询 SQL ,再动态把查询条件为 null 的语句删了。或者说是一开始把查询语句解析了,根据查询条件动态拼上去,类似 Mybaits XML 中的 <IF> 标签,但是我不爱用 XML 。这样我只需要写原生 SQL ,IDEA 对原生 SQL 支持度极高写起来很舒服。最早用 Kotlin 自己写的解析,后来换成 Java 就直接把 Durid 内 SQL 语法解析的部分抽出来依赖 数据库查询封装了一层缓存,就是玩。直接原因是本地开发调试查询远程 Mysql 和 Redis 太慢了,就加了缓存,ThreadLocal 、Caffeine 、Redis 、Mysql 一级一级往下查,支持主键和索引查询的缓存,支持返回自定义的虚拟数据 Sa-Token 一开始同事想用就让用了,后来看了源码觉得自己的业务不用这么复杂,就自己写了一个替换了 自定义注解处理器,用 AbstractProcessor 、JavaPoet 编译时生成代码,可以少写些模版代码,要是没注解处理器 Kotlin 换到 Java 就不方便太多 属性复制用本站上推广过的 IDEA 插件 BeanMappingKey ,针对复杂类之间的代码生成还是不大好用,需要手动调整 |
![]() |
18
BQsummer 133 天前
shiro 比 Spring Security 简单点;
工具类: guava / apache commons; 日志: logback; task: quartz; |
![]() |
19
Oktfolio 133 天前
@tairan2006 #6 retrofit 呢
|
20
edotac 133 天前
POJO 映射:MapStruct
定时任务:XXL-JOB HTTP:OpenFeign |
21
ily433664 133 天前
Spring Security -> sa-token
Spring Data Redis -> redisson Spring Task -> xxl-job hutool -> 其他 |
23
kachu673 OP 感谢各位大佬的分享,如有好的想法可以在评论区多多交流
|
24
yazinnnn 133 天前
spring -> quarkus
spring cloud -> k8s java -> kotlin, scala jit -> aot |
![]() |
25
shanghai1943 133 天前
没有人用 joda time 来处理时间了吗
|
![]() |
26
xiyangzh 133 天前 ![]() 给大家推荐两个小众的精品:
logbook: An extensible Java library for HTTP request and response logging, 可以生成很漂亮的 http 请求和响应的日志,辅以日志过滤,脱敏等功能。 如 json 格式的 http 请求和响应 { "origin": "remote", "type": "request", "correlation": "2d66e4bc-9a0d-11e5-a84c-1f39510f0d6b", "protocol": "HTTP/1.1", "sender": "127.0.0.1", "method": "GET", "uri": "http://example.org/test", "host": "example.org", "path": "/test", "scheme": "http", "port": null, "headers": { "Accept": ["application/json"], "Content-Type": ["text/plain"] }, "body": "Hello world!" } { "origin": "local", "type": "response", "correlation": "2d66e4bc-9a0d-11e5-a84c-1f39510f0d6b", "duration": 25, "protocol": "HTTP/1.1", "status": 200, "headers": { "Content-Type": ["text/plain"] }, "body": "Hello world!" } 围观----> https://github.com/zalando/logbook problem: is a library that implements application/problem+json 。 能够生成漂亮的 Json 异常信息。对了 jhipster 默认就使用了它。 例如: Problem.builder() .withType(URI.create("https://example.org/out-of-stock")) .withTitle("Out of Stock") .withStatus(BAD_REQUEST) .withDetail("Item B00027Y5QG is no longer available") .with("product", "B00027Y5QG") .build(); 生成为这样的异常消息: { "type": "https://example.org/out-of-stock", "title": "Out of Stock", "status": 400, "detail": "Item B00027Y5QG is no longer available", "product": "B00027Y5QG" } 围观-----> https://github.com/zalando/problem |
![]() |
27
xiyangzh 133 天前
同时再次推荐下 Jhipster ,spring 一站式解决方案
|
28
WashFreshFresh 133 天前
属性复制/映射 MapStruct
|
![]() |
29
anakinsky 133 天前
http 请求和响应日志
https://github.com/zalando/logbook |
![]() |
30
cheng6563 133 天前
别用 Spring Security ,会变得不幸。
这玩意花大把时间配置完过了一个月就完全不知道自己配置了个啥了。 而且版本更新有前端娱乐圈的作风,完全不像 Spring 家族的风格。 |
![]() |
31
nerkeler 133 天前
工具类:apache commons
监控:springAdmin |
![]() |
32
stuazt 133 天前
@Ayanokouji Kotlin 是真的香,用一段时间 Kotlin 回去写 Java ,巨难受
|
![]() |
33
key0323 133 天前
spring security 貌似是 oauth2.0 的实现,第三方授权我会选择使用,简单登录一般还是手撸
|
![]() |
34
cutecore 133 天前
HttpCilent > RestTemplate > retrofit
|
![]() |
35
itechnology 133 天前
Spring Security 强烈不建议使用。太难用了,还不如自己手撸。
|
![]() |
36
LeegoYih 133 天前
一眼望去就有几个💩框架/库
|
![]() |
37
BBCCBB 133 天前
http 用 feign/ spring cloud openfeign.
|
![]() |
38
superchijinpeng 133 天前
spring -> quarkus
|
39
godleon 133 天前 ![]() spring security -> 如果不需要支持第三方登录,建议手撸,拦截器还是自己实现的比较灵活,security 太重 链路太长..
alioss -> 不上云建议 minio ,简便维护,而且读写性能还可以; hutool -> 建议别直接按模块引入,如果全局的话,太大了... 但是我还是喜欢自己封装;项目不做太多依赖; httpClient -> 如果用的 JDK 版本比较高,可以直接用 一些建议,如果你项目里习惯各种依赖插件,可以建议你尝试升级 JDK 版本,用一些 spring 提供的新特性有时候你会发现,可能比插件封装的性能还要高 |
![]() |
40
KevinBlandy 133 天前
|
![]() |
41
suyabgaran 133 天前
@uianz JOOQ 好评
|
![]() |
42
ourslay 133 天前 via iPhone
springdoc springfox 替代品
okhttp restclient RestTemplate 实现 spring security |
![]() |
43
dnjat 133 天前
这个主题太棒了.补一个 easyexcel
|
![]() |
44
zhiyu1998 133 天前
工作流:activiti
|
![]() |
45
luzemin 132 天前
看到这么多人不推荐 Spring Security 我就放心了
|