亚马逊 AmazonS3的使用

https://blog.csdn.net/cxl_shelly/article/details/121081548

s3browser下载:https://s3browser.com/
在这里插入图片描述

在这里插入图片描述
https://www.cnblogs.com/bodhitree/p/6675160.html

#-------------------- S3 start -------------------
# http or https
amazonaws.s3.protocol = http
# host:port       (test1.endpoint=192.168.66.224:7480)
amazonaws.s3.endpoint = 192.168.66.224:7480
# accessKey    (test1.accessKey=123456)
amazonaws.s3.accessKey = 123456
# secretKey    (test1.secretKey=123456)
amazonaws.s3.secretKey = 123456
# maxConnections   (def=50)
amazonaws.s3.maxConnections = 50
# connectionTimeout   (def=10000)
amazonaws.s3.connectionTimeout = 10000
# socketTimeout   (def=50000)
amazonaws.s3.socketTimeout = 50000
# useGzip   (def=false)
amazonaws.s3.useGzip = false
# bucketName   (def=icollect)
amazonaws.s3.bucketName = icollect
#amazonaws.s3.template.key (def=template.xlsx)
amazonaws.s3.templateKey = template
#amazonaws.s3.template.path (def=template.xlsx)
amazonaws.s3.templatePath = D://template
#-------------------- S3 end -------------------
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Spring Boot Amazon S3 是一个集成组件,它允许你在使用 Spring Boot 框架的 Java 应用程序中轻松地与 Amazon Simple Storage Service (S3) 集成。Amazon S3 是一种云存储服务,用于存储和检索大量的静态文件、应用程序数据或其他任何类型的数据。 在 Spring Boot 中集成 Amazon S3,你可以执行以下操作: 1. 添加依赖:在你的 `pom.xml` 或者 `build.gradle` 文件中添加 AWS SDK for Java 和 Spring Cloud AWS S3 的依赖。 ```xml <!-- Maven --> <dependency> <groupId>com.amazonaws</groupId> <artifactId>aws-java-sdk-s3</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-aws-s3</artifactId> </dependency> // Gradle implementation 'com.amazonaws:aws-java-sdk-s3' implementation 'org.springframework.cloud:spring-cloud-starter-aws-s3' ``` 2. 配置AWS凭证:你需要提供 AWS 密钥(ACCESS_KEY_ID)和秘密访问密钥(SECRET_ACCESS_KEY),或者设置环境变量(如 `AWS_ACCESS_KEY_ID` 和 `AWS_SECRET_ACCESS_KEY`),以授权对 S3 的访问。 3. 创建 S3 实体和Repository:根据需要定义 S3 存储的对象模型,如 `S3Object` 或自定义实体,然后创建对应的 Repository 接口以支持 CRUD 操作。 4. 上传/下载文件:使用 Spring Boot 的 `@Autowired` 注解注入 S3Client 对象,然后调用其提供的方法来上传文件到 S3 或从 S3 下载文件。 5. 使用S3服务:Spring Cloud AWS S3 提供了诸如 `AmazonS3Operations` 或 `AmazonS3Client` 的便利类,可以直接用于执行常见的 S3 操作,如列出对象、删除对象等。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值