SNWCreations/KookBC

在插件中使用 Hutool-DB 时,Hutool-DB所需的 db.setting 会找不到(无论释放到哪里)

Closed this issue · 1 comments

您期望得到什么

在插件中正常使用 Hutool-DB 操作数据库

实际得到什么

实际上报错说找不到 db.setting (在项目中的位置为src/main/resources)

报错日志

https://pastebin.ubuntu.com/p/G3RxysRGZB/

尝试

将 db.setting 丢进 KOOKBC 的 resources 中一并打包它才能找到

hutool默认使用contextClassLoader来获取。插件的resource只能在其对应的classloader中获取,正确写法:

new Setting("path", 插件主类.class, Setting.DEFAULT_CHARSET, true);