How to prevent Singleton Class from Reflection and Serialization
First create a singleton class.
Now try to break the Singleton with Reflection
How to prevent Object Creation with Reflection - Check in the private constructor if object already created then throw an exception.
If we run the reflection code, we will get this exception.
Comments
Post a Comment