2 Replies Latest reply on Nov 5, 2013 7:10 AM by vic neiman

    Using reflection on objects that have @Inject references

    vic neiman Newbie

      Hi all,


      I have a scenario where I am using reflection to instantiate a bean, using Object.newInstance(), the bean has an injected reference to a web service. The object that is created as a result does not have the injected reference initialised, so I keep getting null pointers when trying to use that reference. I understand that I cannot expect the injected reference to be initialised to a value using this approach as reflection does not know about dependency injection but I cannot find any resources that will point me to a solution. Any help would be appreciated.


      Injected reference looks like this:

      @Inject @Reference 

        private Base24 base24;


      Regards and thanks