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

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

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

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

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

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

    Thank you so much Naveen🙏

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

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

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

    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?