spring-boot-starter-well-oss

well-oss

License

License

Categories

Categories

Spring Boot Container Microservices
GroupId

GroupId

com.zxk175
ArtifactId

ArtifactId

spring-boot-starter-well-oss
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

pom.sha512
Description

Description

spring-boot-starter-well-oss
well-oss
Project URL

Project URL

https://github.com/zxk175/spring-boot-starter-well-oss
Source Code Management

Source Code Management

https://github.com/zxk175/spring-boot-starter-well-oss

Download spring-boot-starter-well-oss

Dependencies

runtime (14)

Group / Artifact Type Version
org.springframework : spring-webmvc jar 5.2.4.RELEASE
org.springframework.boot : spring-boot-starter jar 2.2.0.RELEASE
org.springframework.boot : spring-boot-configuration-processor jar 2.2.0.RELEASE
org.springframework.boot : spring-boot-autoconfigure-processor jar 2.2.0.RELEASE
javax.servlet : javax.servlet-api jar 4.0.1
io.springfox : springfox-swagger2 jar 2.7.0
javax.validation : validation-api jar 2.0.1.Final
org.hibernate.validator : hibernate-validator jar 6.1.2.Final
cn.hutool : hutool-core jar 5.2.3
com.alibaba : fastjson jar 1.2.66
com.github.sd4324530 : JTuple jar 1.2.1
com.squareup.okhttp3 : okhttp jar 4.1.0
com.aliyun.oss : aliyun-sdk-oss jar 3.8.1
com.qcloud : cos_api jar 5.6.18

Project Modules

There are no modules declared in this project.

spring-boot-starter-well-oss

基于Gradle6.2.2

使用方法

1、pom文件直接添加依赖(该jar已经发布到maven中央仓库)

implementation "com.zxk175:spring-boot-starter-well-oss:1.0.0"

2、在配置文件添加以下配置(只配 tx or ali)

oss:
  tx:
    access-key: xxx
    access-secret: xxx
    access-domain: xxx
    bucket-name: xxx
    region: ap-guangzhou
  ali:
    access-key: xxx
    access-secret: xxx
    access-domain: xxx
    end-point: https://oss-cn-shenzhen.aliyuncs.com
    bucket-name: xxx
    time-out: 300000

3、使用代码

@Controller
@AllArgsConstructor
@RequestMapping("/file")
public class FileController {

    private BaseOssService ossService;


    @ResponseBody
    @PostMapping("/upload/v1")
    public Response<Object> upload(MultipartFile file) throws Exception {
        System.out.println(ossService.getOssName());
        System.out.println(ossService.getProperties().toString());
        OssModel ossModel = ossService.uploadSuffix(file.getInputStream(), "oss/test/", "png");
        return Response.success(ossModel);
    }

}

Versions

Version
1.0.0