Solon

qiniu-kodo-solon-plugin

<dependency>
    <groupId>org.noear</groupId>
    <artifactId>qiniu-kodo-solon-plugin</artifactId>
</dependency>

1、描述

分布式扩展插件。基于 qiniu kodo 适配的 solon cloud 插件。提供文件存储服务。

2、配置示例

solon.cloud.qiniu.kodo.file:
    bucket: world-data-dev
    regionId: "cn-east-2" # v1.10.3 开始支持
    endpoint: "https://xxx.yyy.zzz"
    accessKey: iWeU7cOoPLRokg2Hdat0jGQC
    secretKey: ZZIH6mT4VLAy68mVP80F7LiB5SpSEM7N

3、应用示例

public class DemoApp {
    public void main(String[] args) {
        SolonApp app = Solon.start(DemoApp.class, args);

        String key = "test/" + Utils.guid();
        String val = "Hello world!";
        
        //上传媒体
        Result rst = CloudClient.file().put(key, new Media(val));
        
        //获取媒体,并转为字符串
        String val2 = CloudClient.file().get(key).bodyAsString();
    }
}