I would prefer the second. Because the;
For the first; when you change your version of Java, you need to do extra work (you must add these ssl certificates to cacerts again).
For the third; when you need to add another ssl certificate. You must change your code.
So, the second is the best choice, because; you will not need to change your code when a new ssl appears (you just add it to the external trustStore), and you will not do anything for these certificates when upgrading the Java version.
mokarakaya
source share