jdbc.password=
How can I assign jdbc.password
key in my application.properties file an empty string?
I understand I can do this programmatically as follows, but I would like to set this in properties file.
Properties props = new Properties();
props.put("password", "");
To set properties in a Java Properties instance you use the setProperty() method. Here is an example of setting a property (key - value pair) in a Java Properties object: properties.
Just leaving the value empty on the RHS should be fine:
password=
Sample code:
import java.io.*;
import java.util.*;
class Test{
public static void main(String [] args) throws Exception {
Properties props = new Properties();
props.load(new StringReader("password="));
System.out.println(props.size()); // 1
System.out.println(props.getProperty("password").length()); // 0
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With