我正在尝试从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的结果。我的encrypt.rsa
文件中有bootstrap.yml
个配置,该文件正在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
,测试将失败,并且由于以下原因导致服务无法启动上面的错误。