DFS Binder S3
The recommended production binder for AWS S3 and S3-compatible services such as MinIO, OSS, COS, and LocalStack.
<dependency>
<groupId>io.github.loadup-cloud</groupId>
<artifactId>loadup-components-dfs-binder-s3</artifactId>
</dependency>loadup:
dfs:
binder-type: s3
binder.s3.bucket: loadup-files
binder.s3.region: us-east-1
binder.s3.endpoint: https://s3.amazonaws.com
binder.s3.access-key: ${AWS_ACCESS_KEY_ID}
binder.s3.secret-key: ${AWS_SECRET_ACCESS_KEY}
binder.s3.path-style-access-enabled: falseThe binder persists filename and custom metadata in S3 object metadata, generates presigned GET URLs, and supports
initiate/upload-part/complete/abort multipart operations. The bucket and credentials are external infrastructure;
create-bucket is intended for development only.
设计与实现
职责与边界
文件存储的具体后端适配模块;由集成方按需引入。
Maven 依赖边界
直接依赖的框架模块:
loadup-components-dfs-api
直接依赖的外部坐标(不含测试与 provided scope):
org.springframework.boot:spring-boot-autoconfiguresoftware.amazon.awssdk:s3com.github.spotbugs:spotbugs-annotations
实现入口
主要入口文件:
分层与调用路径
S3DfsTemplate 直接实现 DfsTemplate,通过 S3 客户端提供对象操作、预签名和分片上传。
业务代码 → API/facade → 当前 binder → 第三方引擎或基础设施binder 实现框架契约,把实现库及其配置隔离在业务 API 之外。
装配规则
S3DfsAutoConfiguration是自动配置入口。@ConditionalOnClass(S3Client.class)@ConditionalOnProperty(prefix = "loadup.dfs", name = "binder-type", havingValue = "s3")@ConditionalOnMissingBean(DfsTemplate.class)
配置归属
S3DfsProperties绑定loadup.dfs.binder.s3。
设计取舍
选择独立 binder,使文件存储实现的依赖留在集成应用;替换底层实现时,业务侧仍使用 DfsTemplate 契约。
集成方式与配置示例见 README.md。