gpt4 book ai didi

spring-boot - 在Spring Boot应用程序配置中是否可以使用Spring Cloud {cipher}?

转载 作者:行者123 更新时间:2023-12-03 21:20:53 25 4
gpt4 key购买 nike

我有一个正在使用Spring Cloud Config的Spring Boot应用程序,但是我想在Spring Boot应用程序bootstrap.yml文件中加密Spring Cloud Config密码。有没有办法做到这一点?下面是一个例子。

Spring Boot应用程序bootstrap.yml

spring:
cloud:
config:
uri: http://locahost:8888
username: user
password: '{cipher}encryptedpassword'

最佳答案

我发现了几件事与此有关。

如果使用bootstrap.yml(或application.yml),则密文格式必须用单引号引起来:

security.user.password: '{cipher}56e611ce4a99ffd99908d2c9aa1461d831722812e4370a5b6900b7ea680ae914'  


如果您使用bootstrap.properties(或application.properties),则密文格式不得包含:

security.user.password= {cipher}56e611ce4a99ffd99908d2c9aa1461d831722812e4370a5b6900b7ea680ae914


[reference docs] [1]显示了没有引号的yml,我从没用过。 SnakeYaml始终报告错误:

"expected <block end>, but found Scalar"

关于spring-boot - 在Spring Boot应用程序配置中是否可以使用Spring Cloud {cipher}?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28421252/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com