[英]Spring Boot - How to define application.yml properties as application.properties
I am currently trying to set up an s3 bucket with my Spring Boot webapp for adding/removing images.我目前正在尝试使用我的 Spring Boot webapp 设置一个 s3 存储桶以添加/删除图像。
The guide I am following uses the following application.yml properties:我遵循的指南使用以下 application.yml 属性:
amazonProperties:
endpointUrl: https://s3.us-east-2.amazonaws.com
accessKey: XXXXXXXXXXXXXXXXX
secretKey: XXXXXXXXXXXXXXXXXXXXXXXXXX
bucketName: your-bucket-name
How can I define these properties in my application.properties file?如何在我的 application.properties 文件中定义这些属性?
All help is very much appreciated, thank you!非常感谢所有帮助,谢谢!
Try to just split them in different lines in your application.properties
: 尝试在
application.properties
中将它们拆分为不同的行:
amazonProperties.endpointUrl= https://s3.us-east-2.amazonaws.com
amazonProperties.accessKey= XXXXXXXXXXXXXXXXX
amazonProperties.secretKey= XXXXXXXXXXXXXXXXXXXXXXXXXX
amazonProperties.bucketName= your-bucket-name
if you're using spring Spring Cloud AWS maven dependency <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-aws</artifactId> </dependency>
如果您使用的是 spring Spring Cloud AWS maven 依赖
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-aws</artifactId> </dependency>
use the following properties in your
file.application.properties
在
文件中使用以下属性。application.properties
cloud.aws.region.static=your region cloud.aws.credentials.accessKey=your access key cloud.aws.credentials.secretKey=your secret key app.awsServices.bucketName=bucketName
refer: https://cloud.spring.io/spring-cloud-static/spring-cloud-aws/1.2.3.RELEASE/multi/multi__basic_setup.html参考: https : //cloud.spring.io/spring-cloud-static/spring-cloud-aws/1.2.3.RELEASE/multi/multi__basic_setup.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.