升级到 Edgware.SR3 时没有符合条件的 RsaProperties 类型的 bean
No qualifying bean of type RsaProperties when upgrading to Edgware.SR3
我正在尝试从 Spring Cloud Edgware.SR2 更新到 Edgware.SR3。当我构建 Spring 云配置服务器时,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 以及 Spring Cloud Config,我需要做哪些更改使用 RSA 加密数据?
- 使用 Spring Boot 2.0.3 和 Spring Cloud Finchley,我需要做什么才能通过测试并为 运行 提供服务?
我正在尝试从 Spring Cloud Edgware.SR2 更新到 Edgware.SR3。当我构建 Spring 云配置服务器时,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 以及 Spring Cloud Config,我需要做哪些更改使用 RSA 加密数据?
- 使用 Spring Boot 2.0.3 和 Spring Cloud Finchley,我需要做什么才能通过测试并为 运行 提供服务?