https://github.com/weimin96/oss-spring-boot-starter
oss-spring-boot-starter is a toolkit based on Spring Boot and Amazon S3. With this toolkit, you can easily perform operations related to OSS (Object Storage Service) storage. 基于springboot的对象存储工具。
https://github.com/weimin96/oss-spring-boot-starter
aws minio obs oss springboot
Last synced: 5 months ago
JSON representation
oss-spring-boot-starter is a toolkit based on Spring Boot and Amazon S3. With this toolkit, you can easily perform operations related to OSS (Object Storage Service) storage. 基于springboot的对象存储工具。
- Host: GitHub
- URL: https://github.com/weimin96/oss-spring-boot-starter
- Owner: weimin96
- License: apache-2.0
- Created: 2023-08-20T15:03:59.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-26T05:29:07.000Z (over 1 year ago)
- Last Synced: 2025-01-26T06:17:47.968Z (over 1 year ago)
- Topics: aws, minio, obs, oss, springboot
- Language: Java
- Homepage:
- Size: 266 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README-zh-CN.md
- License: LICENSE
Awesome Lists containing this project
README
# OSS Spring Boot3 Starter
[](https://github.com/weimin96/oss-spring-boot-starter/actions/workflows/ci.yml)
[](https://github.com/weimin96/oss-spring-boot-starter/releases/)
[](https://repo1.maven.org/maven2/io/github/weimin96/oss-spring-boot-starter/)
[](https://github.com/weimin96/oss-spring-boot-starter/releases/)
[](https://www.apache.org/licenses/LICENSE-2.0.html)
[](https://github.com/weimin96/oss-spring-boot-starter)
[](https://github.com/weimin96/oss-spring-boot-starter)
README: [English](README.md) | [中文](README-zh-CN.md)
Wiki: [Wiki](https://github.com/weimin96/oss-spring-boot-starter/wiki)
前端配套代码 [oss-spring-boot-starter-ui-demo](https://github.com/weimin96/oss-spring-boot-starter-ui-demo)
## 简介
该项目主要是利用主流的OSS对象存储服务(`腾讯云COS`/`阿里云OSS`/`华为云OBS`/`七牛云`/`MinIo`)都兼容Amazon S3(Simple Storage Service)协议的特性,基于Spring Boot的自动化配置特性提供一系列对象存储操作。
## 特性
- 支持:腾讯云、阿里云、华为云、七牛云、京东云、MinIo
- 提供一系列的基础 web 端点和 swagger 文档,支持自由开启
- 查询
- - 连接测试
- - 存储桶查询
- - 大文件分片下载、普通下载
- - 文件列表懒加载查询、树形查询、模糊查询、层级查询
- - 文件夹列表查询
- - 文件预览、文本获取、文件详情
- 操作
- - 大文件分片上传、普通上传、
- - 创建文件夹、上传文件夹
- - 拷贝文件、移动文件
- - 校验是否存在
- 删除
- - 文件删除、文件夹删除
## 版本基础
- JDK 21
- Spring Boot 3.x
[Spring Boot 2.x版本](https://github.com/weimin96/oss-spring-boot-starter/tree/spring2)
## 如何使用
### 引入依赖
- 使用 **Maven** 添加依赖项:
```xml
io.github.weimin96
oss-spring-boot3-starter
${lastVersion}
```
- 或者使用 **Gradle** 添加依赖项:
```gradle
dependencies {
implementation 'io.github.weimin96:oss-spring-boot3-starter:${lastVersion}'
}
```
- 在 `application.yml` 添加配置
```yaml
oss:
endpoint: https://xxx.com
access-key: YOUR_ACCESS_KEY
secret-key: YOUR_SECRET_KEY
bucket-name: your-bucket-name
enable: true
```
- 代码使用
```java
@Autowired
private OssTemplate template;
// 上传文件
ossTemplate.put().putObject("bucket", "1.jpg", new File("/data/1.jpg"));
```
## 参数配置
所有的的配置说明
| 配置 | 类型 | 默认值 | 描述 |
|------------------------|---------|-------|-----------------------------------|
| oss.enable | boolean | false | Enable OSS or not |
| oss.endpoint | String | | Endpoint of the OSS service |
| oss.bucket-name | String | | Bucket name |
| oss.access-key | String | | Access key ID |
| oss.secret-key | String | | Access secret key |
| oss.type | String | | OSS type (options: obs/minio/cos) |
| oss.max-connections | int | 50 | 最大连接数 默认50 |
| oss.connection-timeout | int | 10000 | 连接超时 默认10s |
| oss.http.prefix | String | | Prefix of the endpoint URL |
| oss.http.enable | boolean | false | Enable web endpoints or not |