Search code examples
spring-bootsslapplication.propertiesaws-secrets-manager

How to set value to a property present in application.properties for Spring boot


I have ssl enabled for my spring boot application. I am fetching the keystore password from AWS Secrets Manager through a class in my application. How do I refer to this password in my application.properties?


Solution

  • Once you get the property value, you can set it in the environment as below:

    String password = getPasswordFromKeyStore();
    environment.setProperty("password", password);
    

    So it will get assigned to property defined in application.properties file.