【问题标题】:EnvironmentVariableCredentialsProvider not in providers when running tests运行测试时 EnvironmentVariableCredentialsProvider 不在提供程序中
【发布时间】:2018-06-21 18:47:39
【问题描述】:

我有使用 AWS Kinesis 和 DynamoDB 的 Spring Boot 应用程序。 当我运行应用程序时,我可以看到 AWSCredentialsProviderChain 提供了 EnvironmentVariableCredentialsProvider 以从环境变量中读取 AWS_ACCESS_KEY_IDAWS_ACCESS_KEY .

但是当我运行集成测试时,EnvironmentVariableCredentialsProvider 不在 AWSCredentialsProvider(s) 中。这是我的基本测试类配置:

@ActiveProfiles("integration")
@SpringBootTest
class BaseTest {

}

@SpringBootTest 将 @SpringBootApplication 作为主要配置类,我假设两者应该具有相同的配置上下文。

感谢您的帮助。

谢谢

【问题讨论】:

    标签: amazon-web-services amazon-dynamodb spring-integration-aws


    【解决方案1】:

    嗯,在我的测试中,我使用 spring-cloud-stream-binder-kinesis 来产生事件。 当我删除它并用弹簧集成生产者替换它时问题解决了。

    将用于 kinesis 的 spring cloud binder 和 spring 集成结合在一起非常棘手,对我来说几乎没有问题。在您的应用程序中同时使用这两种方法时要小心。

    【讨论】:

      猜你喜欢
      • 2019-11-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-25
      • 1970-01-01
      • 2014-07-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多