I stored my MySQL DB credentials in AWS secrets manager using the Credentials for other database
option. I want to import these credentials in my application.properties
file. Based on a few answers I found in this thread, I did the following:
- Added the dependency
spring-cloud-starter-aws-secrets-manager-config
- Added
spring.application.name = <application name>
andspring.config.import = aws-secretsmanager: <Secret name>
inapplication.properties
- Used secret keys as place holders in the following properties:
spring.datasource.url = jdbc:mysql://${host}:3306/db_name spring.datasource.username=${username} spring.datasource.password=${password}
I am getting the following error while running the application:
java.lang.IllegalStateException: Unable to load config data from 'aws-secretsmanager:<secret_name>'
Caused by: java.lang.IllegalStateException: File extension is not known to any PropertySourceLoader. If the location is meant to reference a directory, it must end in '/' or File.separator
First, is the process I am following correct? If yes, what is this error regarding and how to resolve this?