Coder Social home page Coder Social logo

spring-boot-starter-oss's Introduction

spring-boot-start-oss

Spring boot with aliyun oss support

usage

in pom.xml add following dependency:

  <dependency>
       <groupId>org.mvnsearch.boot</groupId>
       <artifactId>spring-boot-starter-oss</artifactId>
       <version>1.0.0-SNAPSHOT</version>
  </dependency>

in application.properties file, please add following keys:

 spring.oss.key=xxxx
 spring.oss.secret=yyyy
 spring.oss.bucket=xxx-dev

in your code you can use OssClient directly:

 @Autowired
 OSSClient ossClient;

you can use FileStorageService API to operate file:

 @Autowired
 FileStorageService fileStorageService;

Spring XML Configuration

If you want to setup bean in Spring xml file, please use following code:

 <bean id="ossClient" class="com.aliyun.oss.OSSClient">
      <constructor-arg value="access_key"/>
      <constructor-arg value="access_secret"/>
 </bean>
      
 <bean id="fileStorageService" class="org.mvnsearch.boot.oss.impl.FileStorageServiceOssImpl">
      <property name="accessKey" value="access_key"/>
      <property name="accessSecret" value="access_key"/>
      <property name="bucketName" value="bucket_name"/>
 </bean>

spring-boot-start-oss service List

  • org.mvnsearch.boot.oss.FileStorageService: API to operate the file
  • com.aliyun.oss.OSSClient: aliyun OSSClient

Please use FileStorageService as usual, not OSSClient.

Aliyun OSS endpoint

Please visit http://localhost:8080/oss to view detail information.

FaQ

  • Please upload a "ok.txt" under your buket for health indicator.

spring-boot-starter-oss's People

Contributors

linux-china avatar

Watchers

James Cloos avatar lichensi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.