I know that it is possible to pass connection parameters as an argument, but I have a requirement - the password from the database must be accepted in hidden mode. For example how System.console().readPassword()
1 Answer
If you are using the latest versions of spring-boot 2.X, the below command line will override your datasource password:
java -jar -Dspring.datasource.password=pass your_jar_file.jar
2 Comments
NiyazAkh
yes, but the password will be entered as plain text, I am looking for a way to enter the password in hidden mode
NikolaS
@NiyazAkh when you say as in hidden mode do you actually mean to be able to run your Spring Boot application via terminal by prompting user to enter DB password before running app or by providing some Secret value from a file (e.g.
.env)?