mirror of
https://github.com/dromara/tianai-captcha.git
synced 2026-05-07 22:23:05 +08:00
refactor(resource): 重构资源存储和管理逻辑
- 移除了 AbstractResourceStore 类 - 新增了 CrudResourceStore 接口,定义了 CRUD操作 - 修改了 DefaultImageCaptchaResourceManager,支持批量获取资源和模板 - 重构了 FontCache 类,改为实现 ResourceStore 接口 - 更新了相关应用类,使用新的资源管理逻辑
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package example.readme;
|
||||
|
||||
import cloud.tianai.captcha.common.constant.CaptchaTypeConstant;
|
||||
import cloud.tianai.captcha.resource.CrudResourceStore;
|
||||
import cloud.tianai.captcha.resource.ImageCaptchaResourceManager;
|
||||
import cloud.tianai.captcha.resource.ResourceStore;
|
||||
import cloud.tianai.captcha.resource.common.model.dto.Resource;
|
||||
@@ -15,7 +16,7 @@ public class TestImageCaptcha {
|
||||
public static void main(String[] args) {
|
||||
ImageCaptchaResourceManager imageCaptchaResourceManager = new DefaultImageCaptchaResourceManager();
|
||||
// 通过资源管理器或者资源存储器
|
||||
ResourceStore resourceStore = imageCaptchaResourceManager.getResourceStore();
|
||||
CrudResourceStore resourceStore = (CrudResourceStore) imageCaptchaResourceManager.getResourceStore();
|
||||
// 添加classpath目录下的 aa.jpg 图片
|
||||
resourceStore.addResource(CaptchaTypeConstant.SLIDER, new Resource(ClassPathResourceProvider.NAME, "/aa.jpg"));
|
||||
// 添加远程url图片资源
|
||||
|
||||
Reference in New Issue
Block a user