Singleton Pattern With Reflection Attack - How to protect reflection attacks?

Поделиться
HTML-код
  • Опубликовано: 30 ноя 2024

Комментарии • 6

  • @sharankumar8988
    @sharankumar8988 Месяц назад

    Great explanation 💙 crisp and clear

  • @sakshiaggarwal6199
    @sakshiaggarwal6199 2 месяца назад

    Thank you so much Naveen🙏

  • @__as_
    @__as_ 4 месяца назад +3

    Very Nice 👍
    Plz continue this series of covering important design patterns

  • @anureshnanda07
    @anureshnanda07 4 месяца назад

    Quite an informative one and really look forward to more such videos in implementing various such design patterns in test automation frameworks !!

  • @leninanthony
    @leninanthony 3 месяца назад

    I can create 2 object if I call the getInstance method after calling the reflection method. Frist in constructor in checks for object value is null, if fails and create a new object. Again new object is created when calling getInstance method.
    Browser instance2;
    Constructor constructor = Browser.class.getDeclaredConstructor();
    constructor.setAccessible(true);
    instance2=constructor.newInstance();
    Browser instance1= Browser.getInstance();
    System.out.println("instance 1 : "+instance1.hashCode());
    System.out.println("instance 2 : "+instance2.hashCode());
    I see different has code for the above code.
    How to restrict this?