-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started with oss spring starter
aoliao edited this page Aug 27, 2023
·
1 revision
- 使用 Maven 添加依赖项:
<dependency>
<groupId>io.github.weimin96</groupId>
<artifactId>oss-spring-starter</artifactId>
<version>${lastVersion}</version>
</dependency>
- 或者使用 Gradle 添加依赖项:
dependencies {
implementation 'io.github.weimin96:oss-spring-starter:${lastVersion}'
}
- 在
application.yml
添加配置
oss:
endpoint: https://xxx.com
access-key: YOUR_ACCESS_KEY
secret-key: YOUR_SECRET_KEY
bucket-name: your-bucket-name
- 代码使用
@Autowired
private OssTemplate template;
// 上传文件
ossTemplate.put().putObject("bucket", "1.jpg", new File("/data/1.jpg"));
欢迎Star!