问题描述
在使用 Spring Cloud AWS 进行 repo 时,我注意到 application.yml 包含
spring:
profiles: aws
cloud:
config:
enabled: false
aws:
paramstore:
prefix: /micro
name: microapp
profileSeparator: #
enabled: true
但我找不到这些属性的使用位置。通常,yml 属性是通过 @Value 或 @ConfigurationProperties 导入的,但这里的 repo 中没有用于它们的此类注释。
pom.xml 文件有 spring-cloud-starter-aws
和 spring-cloud-starter-aws-parameter-store-config
依赖项,我猜它们使用了属性。
每当我添加自定义属性(例如 aws.smb.enable
)时,pom.xml 都会抱怨“未知属性”。
我实际上不知道 yaml 文件中的属性如何与 Spring Cloud AWS 配合使用。
解决方法
但我找不到这些属性的使用位置。通常,yml 属性是通过 @Value 或 @ConfigurationProperties 导入的,但这里的 repo 中没有用于它们的此类注释。
你在找哪个仓库? aws
属性在 Spring Cloud AWS 项目中读取。例如,在 org.springframework.cloud.aws.paramstore.AwsParamStoreProperties
using @ConfigurationProperties
中读取 aws.paramstore
属性。
所有 aws
和 cloud.aws
属性都记录在 Spring Cloud AWS docs 中。