Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2736

Enable static injection in SE context

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Major Major
    • None
    • 5.1.0.Final
    • Java SE Support
    • None

      Should be possible to run following sample of EE magic in SE enviroment with Weld-SE:

      @ApplicationScoped
      public class AppController{
      
          @Inject
          static protected Logger Log;
      
          @Inject
          static protected AppController Instance;
      
          public void run(){
              AppController.Log.info("App started");
          }
      
          public static void main(String[] args){
              SeContainerInitializer containerInitializer =
                      SeContainerInitializer.newInstance();
              containerInitializer.initialize();
      
              AppController.Instance.run();
          }
      } 

      Now '@Inject static ...' are ignored and sample crashes with NPE.

      Static Logger injection is extremely useful in SE context. Even the Gooog-le-Guuuizze has this function.

            Unassigned Unassigned
            spamcollector Dmitriy Kuznetsov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: