Small question regarding Java SpringBoot application.properties please.
I have a simple SpringBoot web application, and during the business flow, it needs the javax.net.ssl. trustStore trustStorePassword keyStore keyStorePassword
to be set.
Therefore, in the main, this is what I tried:
@SpringBootApplication
public class MyApplication {
public static void main(String[] args) {
System.setProperty("javax.net.ssl.trustStore", "truststore.jks");
System.setProperty("javax.net.ssl.trustStorePassword", "changeit");
System.setProperty("javax.net.ssl.keyStore", "keystore.jks");
System.setProperty("javax.net.ssl.keyStorePassword", "changeit");
SpringApplication.run(MyApplication.class, args);
}
}
And I verified, this works fine. (removing the property from here will cause my app to fail) Therefore, I would believe those properties works.
I understand I can pass those as command line, but I would like to use application.properties, where all my other properties are.
Now, I would like to externalize those properties into the application.properties / yml please.
What I tried:
server.port=8080
javax.net.ssl.trustStore=truststore.jks
javax.net.ssl.trustStorePassword=changeit
javax.net.ssl.keyStore=keystore.jks
javax.net.ssl.keyStorePassword=changeit
However, those properties are not taken account, I am getting the same behaviour as if I did not set anything.
May I ask, how to set those system properties in application.properties please?
Thank you