Best way define important credentials in spring boot
Many techniques
Using tokens replacement (maven replacor)
application.properties
spring.datasource.password=#MY_DB_PASSWORD#
tokens.properties#MY_DB_PASSWORD#=SECRET_PASSWORD
where tokens.properties has an access protection
Using environment variable
mvn spring-boot:run -Dspring.datasource.password=SECRET_PASSWORD
or simply
spring.datasource.password=${myDbPasswordEnv}
Using Jaspyt to encrypt your properties
One solution is to use Environment variables and property placeholders in the application properties. Lets say, you want to store the password of the database. Create an environment variable:
setx DEV_DB_PASS <your_dev_database_password>
Now, in the application properties file, you can access this value as:
spring.datasource.password = ${DEV_DB_PASS}
You can refer to the official documentation.