Mah*_*ary 7 amazon-web-services spring-boot spring-cloud spring-cloud-config aws-secrets-manager
我使用该选项将 MySQL 数据库凭证存储在 AWS Secret Manager 中Credentials for other database
。我想将这些凭据导入到我的application.properties
文件中。根据我在该线程中找到的一些答案,我执行了以下操作:
spring-cloud-starter-aws-secrets-manager-config
spring.application.name = <application name>
和spring.config.import = aws-secretsmanager: <Secret name>
在application.properties
Run Code Online (Sandbox Code Playgroud)spring.datasource.url = jdbc:mysql://${host}:3306/db_name spring.datasource.username=${username} spring.datasource.password=${password}
我在运行应用程序时收到以下错误:
java.lang.IllegalStateException: Unable to load config data from 'aws-secretsmanager:<secret_name>'
Caused by: java.lang.IllegalStateException: File extension is not known to any PropertySourceLoader. If the location is meant to reference a directory, it must end in '/' or File.separator
Run Code Online (Sandbox Code Playgroud)
首先,我遵循的流程正确吗?如果是,此错误与什么有关以及如何解决?
Mah*_*ary 12
我发现了导致错误的问题。显然我添加了错误的依赖项。
根据最新的文档,用于导入 AWS 密钥的配置支持spring.config.import
已从. 所以更新的依赖关系将是而不是io.awspring.cloud
org.springframework.cloud
io.awspring.cloud:spring-cloud-starter-aws-secrets-manager-config:2.3.3
org.springframework.cloud:spring-cloud-starter-aws-secrets-manager-config:2.2.6
归档时间: |
|
查看次数: |
20720 次 |
最近记录: |