Akalanka Hewawasam
Akalanka Hewawasam

Reputation: 510

How to run custom code before database connection establish in spring boot?

in my source code I need to set some properties, Database connection certifications on code level before the database connection establishes.

        System.setProperty("javax.net.ssl.trustStorePassword", keystorePassword);

edit - I tried it using java -Djavax.net.ssl.trustStorePassword=yourPassword on runtime, but I want to do it in code level.

Upvotes: 0

Views: 816

Answers (1)

thopaw
thopaw

Reputation: 4044

I would suggest that you set this with a -D parameter when starting the JVM like in

java -Djavax.net.ssl.trustStorePassword=yourPassword ...

This goes along with the 12-factor-apps and makes your app easier to maintain

Upvotes: 2

Related Questions