Just to simplify file storage
- QQ exchange group
789585778
,You can obtain detailed graphic documents and questions and answers for each project
opcooc-storage encapsulates and expands aws s3
-
Add opcooc-storage dependency
- Maven:
<dependency> <groupId>com.opcooc</groupId> <artifactId>opcooc-storage-boot-starter</artifactId> <version>1.1.1</version> </dependency>
- Gradle
compile group: 'com.opcooc', name: 'opcooc-storage-boot-starter', version: '1.1.1'
- Maven:
-
Add config , add config information in
application.yml
opcooc: enabled: true primary: MINIO client: MINIO: bucket-name: opcooc end-point: http://xxx:9000 access-key: xxx secret-key: xxx OSS: bucket-name: opcooc end-point: https://oss-cn-shanghai.aliyuncs.com access-key: xxx secret-key: xxx
-
Use it
@RestController @RequiredArgsConstructor(onConstructor_ = @Autowired) @RequestMapping(value = "/client", produces = {APPLICATION_JSON_VALUE}) public class ClientController { private final StorageClient storageClient; @GetMapping(value = "create-folder") public Response createFolder(@RequestParam String source, @RequestParam String folder) { storageClient.op(source).createFolder(folder); return Response.success(); } }
This showcase is just a small part of opcooc-storage features. If you want to learn more, please refer to the documentation.
opcooc-storage is under the Apache 2.0 license. See the Apache License 2.0 file for details.