我有一个使用 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
[参考文档][1] 显示了不带引号的 yml,但我从未使用过。 SnakeYaml总是报错:
"expected <block end>, but found Scalar"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)