【发布时间】:2018-06-27 18:29:40
【问题描述】:
我正在尝试从 Spring Cloud Edgware.SR2 更新到 Edgware.SR3。当我构建 Spring Cloud Config Server 时,ApplicationTests 中的默认 contextLoads 测试失败并出现以下错误:
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'encryptionBootstrapConfiguration': Unsatisfied dependency expressed through field 'encryptor'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.cloud.config.server.config.DefaultTextEncryptorConfiguration': Unsatisfied dependency expressed through field 'locator'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.cloud.config.server.config.EncryptionAutoConfiguration$KeyStoreConfiguration': Unsatisfied dependency expressed through field 'rsaProperties'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.cloud.bootstrap.encrypt.RsaProperties' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
我怀疑这是this change in Spring Cloud Commons 的结果。我的bootstrap.yml 文件中有encrypt.rsa 配置,该文件在Edgware.SR2 中运行,我尝试将compile( "org.springframework.security:spring-security-rsa" ) 添加到build.gradle。
使用 Spring Boot 1.5.14 和 Spring Cloud Edgware.SR3 (Spring Cloud Config 1.4.3 and Spring Cloud Commons 1.3.3),只有测试失败。如果我注释掉测试,构建然后运行,它会成功启动并解密我的配置。如果我去 start.spring.io 创建一个新的 Spring Cloud Config 项目,添加我的application.yml,我的bootstrap.yml 并包含spring-security-rsa,由于上述错误,测试失败并且服务无法启动。
- 为了让默认测试通过 Spring Boot 1.5.14 和 Spring Cloud Edgware.SR3 以及使用 RSA 加密数据的 Spring Cloud Config,我需要进行哪些更改?
- 我需要做些什么才能让测试通过并使用 Spring Boot 2.0.3 和 Spring Cloud Finchley 运行服务?
【问题讨论】:
标签: java spring spring-cloud spring-cloud-config