refactor: 规范化代码 — 线程安全、日志、资源泄漏、敏感配置、命名、Lombok

- 线程安全: ArrayList→CopyOnWriteArrayList, HashMap→ConcurrentHashMap+synchronized→computeIfAbsent
  - 日志规范: 22处println→SLF4J, 20处printStackTrace→log.error, 空catch加入log.warn
  - 资源泄漏: CloseableHttpClient提取为static单例复用TCP连接
  - 敏感配置: Bot Token/Cookie/IP/订阅URL移至application.yaml+@Value注入
  - 命名规范: *ServiceImpl→*Service去除误导Impl后缀
  - API设计: Response.getResult()→getData(),旧方法标@Deprecated兼容
  - 构造器注入: 全部替换为Lombok @RequiredArgsConstructor,init逻辑→@PostConstruct
  - 依赖: Lombok 1.18.30→1.18.40支持JDK25,新增maven-compiler-plugin注解处理器路径
This commit is contained in:
2026-06-06 18:26:19 +08:00
parent 29f1532dea
commit 2f10d7a868
29 changed files with 278 additions and 311 deletions
+13 -16
View File
@@ -25,19 +25,16 @@ spring:
enabled: true
#personal-service:
# StoragePath: /storage/
#
#gallery-manage-service:
# target-path: /root/gallery/
# cache-size: 100
#
#remote-service:
# ip: 5.255.110.45
#
#local-service:
# DouNaiClash: https://aaaa.gay/link/X7zEqkIx5gtIGugO?client=clashmeta
# DouNaiV2ray: https://aaaa.gay/link/X7zEqkIx5gtIGugO?client=v2
#
#bot:
# token: 5222939329:AAHa6l9ZuVVdNSDLPI_H-c8O_VgeOEw5plA
# Application secrets — override via environment variables or external config in production
gallery:
cookie: "ipb_session_id=af2b2b1a795b39550711134d7bdcbf7f; ipb_member_id=5774855; ipb_pass_hash=4b061c3abe25289568b5a8e0123fb3b9; sk=oye107wk02gtomb56x65dmv4qzbn; nw=1"
remote:
ip: "5.255.110.45"
local:
dou-nai-clash: "https://aaaa.gay/link/X7zEqkIx5gtIGugO?client=clashmeta"
dou-nai-v2ray: "https://aaaa.gay/link/X7zEqkIx5gtIGugO?client=v2"
bot:
token: "5222939329:AAHa6l9ZuVVdNSDLPI_H-c8O_VgeOEw5plA"