使用 @ConfigurationProperties 在 Spring Boot 应用程序中无法识别 AWS 参数存储值

问题描述 投票:0回答:0

我在 Spring Boot 应用程序之一中有一个以下课程。

@ConfigurationProperties(prefix = "authorizepartner")
@Component
@Data
public class EnabledClientNameForAuthorize {
  private List<String> enabledClientName;
}

在我给出的

application.properties
文件中
authorizepartner.enabledclientname=ABC

我们正在使用 AWS 参数存储来覆盖此文件中配置的属性。

在参数存储中,我尝试了以下配置,但似乎没有考虑到。

"authorizepartner.enabledClientName":"ABC,XYZ"
"authorizepartner.enabledclientname":"ABC,XYZ"

如果我使用如下所示的 @Value 并在 AWS 参数存储中覆盖它,则一切正常。

@Value("${valid.productIds}")
private Set<String> validProductIds;

要覆盖

valid.productIds
中给出的
application.properties
,我们只需将其放入参数存储中即可正常工作。

"valid.productIds": "PQR,ASDF" 
amazon-web-services spring-boot spring-cloud aws-parameter-store
© www.soinside.com 2019 - 2024. All rights reserved.