我想为spring-cloud-config服务器设置server.ssl.key-store-password,配置将来自GIT (application.yml)。
下面是我想要在application.yml中配置的内容
server:
port: 8760
ssl:
key-store: path to .jks
key-store-password: '{cipher}encrypted password'
key-store-type: jks
key-password: '{cipher}encrypted password'在引导配置服务器时,它使用TextEncryptor FailsafeTextEncryptor配置EncryptionBootstrapConfiguration,当为EnvironmentDecryptApplicationInitializer调用解密函数时,该配置将失败。
怎样才能使我们的EncryptionBootstrapConfiguration自定义密码能够在启动配置服务器时使用{ TextEncryptor }
发布于 2017-01-08 02:19:31
我得到了这个错误。要修复它,我必须将EncryptionConfiguration和TextEncryptor添加到spring.factory文件中。
我有3个文件:
加密配置:
@Configuration
public class AESEncryptionConfiguration {
@Bean
EnvironmentDecryptApplicationInitializer environmentDecryptApplicationInitializer() {
return new EnvironmentDecryptApplicationInitializer(new AESTextEncryptor());
}
}TextEncryptor:
@Component
public class AESTextEncryptor implements TextEncryptor {
@Override
public String encrypt(String text) {
.
.
.
}
@Override
public String decrypt(String encryptedText) {
.
.
.
}
}然后,我必须在/src/main/resources/META-INF/spring.factories中添加对这两个文件的引用
org.springframework.cloud.bootstrap.BootstrapConfiguration=com.rs.config.AESEncryptionConfiguration,com.common.encryption.AESTextEncryptor通过这样做,我能够创建自定义密码。
https://stackoverflow.com/questions/40079293
复制相似问题