read value from .txt to application.properties

Issue

I created a maven project which connects to a database . The problem I am facing is I have hardcoded the db username and password but I according to the requirement it should be dynamically read from a .txt file in local path.
Is there any possible way for this solution or any other strategy that I should follow.

Thanks in advance

Solution

The java.util.Properties class has several load-methods that is easy to use.

Answered By – Just another Java programmer

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published