We have a Java application where a job is scheduled to run every 5 minutes. In that job, there is a security component that does the following every time it is executed:
java.security.Security
.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
My questions are:
- Is it required to add the security provider multiple times in the application? Does it serve any purpose? To me, it doesn't make sense and adding it once should suffice.
- Is it a candidate for a potential memory leak in the application?
To clarify, I want to add Bouncy Castle security provider programmatically in my application and not statically via JRE. IMO, adding Bouncy Castle security provider once in the application is enough and I need not do in multiple times.