Reputation: 7781
I use ssl to acces to my database, I have some configuration in JAVA JVM Args.
Is there a way to move these configuration into spring configuration file (My config are in application.yml) ?
JVM args that I want to move are :
-Djavax.net.ssl.keyStore=/path/to/keystore.jks
-Djavax.net.ssl.keyStorePassword=<password>
-Djavax.net.ssl.trustStore=/path/to/truststore.jks
-Djavax.net.ssl.trustStorePassword=<password>
Upvotes: 0
Views: 5034
Reputation: 7781
You can add JVM arguments for SSL properties in the application.yml file like this :
server:
ssl:
key-store: /path/to/keystore
key-store-password: <password>
trust-store: /path/trust/store
trust-store-password: <password>
Common properties that can use in Spring properties file are defined here : https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
Upvotes: 1
Reputation: 718926
In order for the properties to take effect, they need to be in the system Properties
object before the SSL classes are initialized.
The chances are that if you attempt put them into the Spring config file, and (somehow) transfer them to the system Properties
object, they won't get there soon enough.
Having said that ... the following Q&A explains how to inject new properties:
(Read all of the Answers.)
Upvotes: 1