I am trying to use AWS Secrets Manager to store secrets for a springboot microservice. I was able to configure everything and I can see that on startup the application is loading the secret that in my case is a json document. In particular I am using
'org.springframework.cloud:spring-cloud-starter-aws-secrets-manager-config:2.2.1.RELEASE'
Since I noticed that AwsSecretsManagerPropertySource was able to parse the response json into a Map of Objects I tried to use a nested structure for my secret but if I tried to inject any field of the json using the @Value annotation is failing with a conversion exception. So, if my secret is a json with only string as fields I am able to inject them. For example:
{
"a.b":"value"
...
}
using
@Value("${a.b}")
String field;
it´s working fine but if I have a secret like
{
"a": {
"b":"value"
}
I saw that the json is successfully parsed but using the annotation
@Value("${a.b}")
String field;
I am not able to retrieve a field and if I try something like
@Value("${a}")
Map<String, String> field;
it´s failing due to a conversion issue (unable to convert from a LinkedHashMap to a string). Is there any way to handle a nested structure into a secret or should I just used a json with no nested objects? Thanks a lot!