aliyun-oss-spring-boot-starter

Aliyun OSS Spring Boot Starter

License

License

Categories

Categories

Spring Boot Container Microservices
GroupId

GroupId

com.github.lkqm
ArtifactId

ArtifactId

aliyun-oss-spring-boot-starter
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

aliyun-oss-spring-boot-starter
Aliyun OSS Spring Boot Starter
Project URL

Project URL

https://github.com/lkqm/aliyun-oss-spring-boot-starter
Project Organization

Project Organization

Pivotal Software, Inc.
Source Code Management

Source Code Management

https://github.com/lkqm/aliyun-oss-spring-boot-starter

Download aliyun-oss-spring-boot-starter

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.lkqm/aliyun-oss-spring-boot-starter/ -->
<dependency>
    <groupId>com.github.lkqm</groupId>
    <artifactId>aliyun-oss-spring-boot-starter</artifactId>
    <version>1.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.lkqm/aliyun-oss-spring-boot-starter/
implementation 'com.github.lkqm:aliyun-oss-spring-boot-starter:1.0.2'
// https://jarcasting.com/artifacts/com.github.lkqm/aliyun-oss-spring-boot-starter/
implementation ("com.github.lkqm:aliyun-oss-spring-boot-starter:1.0.2")
'com.github.lkqm:aliyun-oss-spring-boot-starter:jar:1.0.2'
<dependency org="com.github.lkqm" name="aliyun-oss-spring-boot-starter" rev="1.0.2">
  <artifact name="aliyun-oss-spring-boot-starter" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.lkqm', module='aliyun-oss-spring-boot-starter', version='1.0.2')
)
libraryDependencies += "com.github.lkqm" % "aliyun-oss-spring-boot-starter" % "1.0.2"
[com.github.lkqm/aliyun-oss-spring-boot-starter "1.0.2"]

Dependencies

compile (4)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter jar 1.5.22.RELEASE
org.springframework.boot : spring-boot-configuration-processor Optional jar 1.5.22.RELEASE
com.aliyun.oss : aliyun-sdk-oss jar 3.10.2
org.projectlombok : lombok Optional jar 1.16.22

test (1)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-test jar 1.5.22.RELEASE

Project Modules

There are no modules declared in this project.

aliyun-oss-spring-boot-starter

Aliyun oss spring boot starter.

Supports: JDK 1.7, spring-boot 1.5.x, spring-boot 2.x

Features

  • Spring Boot快速接入阿里云oss.
  • 支持默认bucket、内网请求、自定义域名、多种认证方式.
  • 提供模版操作类AliyunOssTemplate方便上传/下载等.

Quick

  1. 添加依赖

    <dependency>
       <groupId>com.github.lkqm</groupId>
       <artifactId>aliyun-oss-spring-boot-starter</artifactId>
       <version>1.0.2</version>
    </dependency>
    
  2. 配置(application.properties)

    aliyun.oss.endpoint=@endpoint                    # 阿里云服务地址(必)
    aliyun.oss.internal-endpoint=@internalEndpoint   # 阿里云服务地址内网, 配置后上传下载会使用, 不影响返回的url地址
    aliyun.oss.region-id=@regionId                   # 地区标识, 当role-arn不为空,必填
    
    aliyun.oss.access-key-id=@keyId                  # 访问key(必)
    aliyun.oss.access-key-secret=@secret             # 访问密钥(必)
    aliyun.oss.security-token=@token                 # token
    aliyun.oss.role-arn=@roleArn                     # STS授权角色,如果不为空将使用STS构建OSS
    
    aliyun.oss.bucket=@bucket                        # 默认上传的空间(必)
    aliyun.oss.bucket-custom-domain.@bucket=@domain  # 配置自定义域名
    
    aliyun.oss.config.XXX=@xxx                       # 更多客户端配置, 参看: `ClientBuilderConfiguration`
    
  3. 注入使用

    @Resource
    AliyunOssTemplate aliyunOssTemplate;
    
    @Resource
    OSS aliyunOssClient;
    
    @Test
    public void test() {
        String url = aliyunOssTemplate.uploadFileText("test/hello.txt", "hello world!");
        System.out.println(url);
    }
    

Versions

Version
1.0.2
1.0.1
1.0.0