I have stored values in AWS secret manager using secret name : config/awsservices/db
. I want to fetch these values using Micronaut framework. below the the configuration -
bootstrap.yml
micronaut:
config-client:
enabled: true
application:
name: awsservices
aws:
secretsmanager:
secrets:
- secret-name: /config/awsservices/db
application.yml
username: ${username}
Micronaut code:
public class FunctionRequestHandler extends MicronautRequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
@Value("${username}")
public String username;
@Override
public APIGatewayProxyResponseEvent execute(APIGatewayProxyRequestEvent input) {
System.out.println("-------------- Inside Main Function -------------");
APIGatewayProxyResponseEvent response = new APIGatewayProxyResponseEvent();
try {
System.out.println("-- username : "+username);
response.setStatusCode(200);
response.setBody("");
} catch (IOException e) {
response.setStatusCode(500);
}
return response;
}
}
In the logs, i am getting username is null
.
How to fetch values from secret manager?