-
Notifications
You must be signed in to change notification settings - Fork 41.2k
PropertySource to read a property's value from file #20842
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Could be a duplicate of spring-projects/spring-framework#21961 or #19990. |
You can do this using an I agree with @bclozel that this is a duplicate of #19990 or spring-projects/spring-framework#21961. |
I'm sorry for raising the duplicate. I actually tried using the |
I want to use docker-swarm secrets in my Dockerized Spring-Boot application. These secrets are mounted as special files into the docker container: the secret text is accessible by reading the file at
/run/secrets/<secret_name>
. This is deemed best-practice in secret handling regarding containers (as opposed to injecting the secret text as environment variable, which isn't even supported by docker-swarm).It would be great if Spring-Boot offered a way to set a property's value from the content of a file so I can write something like this:
This would be similar to how
RandomValuePropertySource
works. Looking at its source it should be straight forward to provide aPropertySource
implementation for reading file content. However, I wasn't able to properly inject my customPropertySource
into the Spring-Boot application start up process.I also wonder if there might be already some spring magic that would allow to set a property's value from file?
If this is a valid feature request, I'd be happy to help out with a pull request and a
PropertySource
implementation thats handled similar to theRandomValuePropertySource
. Otherwise it would be great to provide some information on how I could properly inject myPropertySource
into the start up process.The text was updated successfully, but these errors were encountered: