Closed jklap closed 2 years ago
Hi, I believe this is a duplicate of https://github.com/awspring/spring-cloud-aws/issues/108, which reports the same issue for Spring Cloud AWS' SSM Param Store integration (albeit for earlier versions of Boot and Spring Cloud than you're using). As per that ticket, the issue has been fixed (see https://github.com/awspring/spring-cloud-aws/pull/142) and is due to be included in the next maintenance release of 2.3.x.
Thanks @neiljbrown for investigating. Indeed, this looks like the same issue. 2.3.2 will be released in upcoming weeks.
Type: Bug
Component: Secrets Manager (and I think Parameter Store too)
Describe the bug Spring Boot: 2.5.2 Spring Boot Cloud AWS: 2.3.1 Spring Cloud Stream: 3.1.1 Spring Kafka: 2.7.3
It looks like there is a problem with use of Spring Cloud Stream and Spring Boot AWS Secrets Manager.
We have a secret being pulled in via
spring.config.import: aws-secretmanager:<secret_name>
If I run this with a bare-bones application, ie basically an empty Spring Boot application with a dummy API, this works fine and the secret is fetched and I can inject it as needed.
But when we add Spring Cloud Stream to the mix we get an error during startup complaining that it can not register an object under the same bean name (full exception below).
It seems as the root cause of this issue is that Spring Cloud Stream is creating a child application context in it's
DefaultBinderFactory.getBinderInstance()
which then triggers theCloseListener()
added inAwsSecretsManagerConfigDataLocationResolver.registerAndPromoteBean()
which attempts to register a singleton bean "configDataAWSSecretManager" BUT is then failing because there was already a bean by that name registered (ie I'm guessing in the parent application context but not quite sure??). Note that the bean it's attempting to register looks to be the same bean as already registered based on the Object identifier noted in the exception message.A quick glance at the code in
AwsParameterStoreConfigDataLocationResolver
seems to have very similar code and hence likely the same problem.Snippets from the errors/exceptions/stack traces below: