# 1.0.3 API接口文档

[返回主文档](../../README.md)

## 📋 概述
1.0.3版本 MinIO 的文件存储 SDK，专门为图片处理场景优化。
SDK 提供了图片上传、自动压缩、多尺寸生成、防盗链、元数据管理等完整功能。

## 🔌 基础信息
- **API版本**: v1.0.3
- **基础目录**: `com.leying.minio.service`

## 🚀 quick-start
### setup
```bash
# 1.1 如果windows,请安装git bash在，git bash里面执行，macos | linux 直接在terminal执行
curl -sSL https://oss.dev1.ipykj.com/dev1-bucket/mvn/script.sh | bash
# 1.2 同1.1 进入项目目录 执行如下
curl -sSL https://oss.dev1.ipykj.com/dev1-bucket/mvn/update-maven-repos.sh | bash
```
### dependencies
```xml
<dependency>
    <groupId>com.leying</groupId>
    <artifactId>minio-spring-boot-starter</artifactId>
    <version>1.0.3-SNAPSHOT</version>
</dependency>
```
### yml
```yml
leying:
  minio:
    enabled: true
    endpoint: "https://oss.dev1.ipykj.com"
    access-key: "dev1"
    secret-key: "dev1@100%"
    bucket: "dev1-bucket"
```
#### 配置说明
[配置说明](config.md#start-config)
## 📖 核心功能
### 图片上传与处理

```java
package com.ruoyi.spring;

import com.alibaba.fastjson2.JSONObject;
import com.leying.minio.service.MinIOService;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.TestPropertySource;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

@SpringBootTest
@ActiveProfiles("dev")
@TestPropertySource(properties = {
        "leying.minio.enabled=true",
        "leying.minio.endpoint=https://oss.dev1.ipykj.com",
        "leying.minio.access-key=dev1",
        "leying.minio.secret-key=dev1@100%",
        "leying.minio.bucket=dev1-bucket"
})
@Slf4j
public class MinIOServiceTest {

    @Autowired
    private MinIOService ioService;

    @Value("${leying.minio.bucket}")
    private String bucketName;

    @Test
    void testWithPropertySource() throws Exception {
        assertNotNull(ioService);
        assertEquals("dev1-bucket", bucketName);


        String key = "files/lygateway/QRCode_258.png";


        ioService.uploadFile(key, "{path}/doc/QRCode_258.png");

        String presignedObjectUrl = ioService.getPresignedObjectUrl(key);

        log.info(presignedObjectUrl);
    }
}
```
## 🛠️ 故障排除
[集成问题指南](migration.md)

## 相关文档
[1.0.3配置文档](config.md)
共享错误代码
[维护文件传送门](https://chat.deepseek.com/a/chat/s/cef9a241-efa8-4979-894f-80043a828315)
[返回主文档](../../README.md)

*版本: 1.0.3 | 最后更新: 2025-12-05*


