title: Why my instance variable is not initialized by @Inject giving null?
body: <p>A.java</p>
  
  <pre><code>Class A(){
      Para1 para1;
      Para2 para2;     // Getting proper Value no issue with this.
      private void method_A(){
           int sortField = service.getValue();    // Getting proper value no issue.
           if(sortField == null){
           DefaultGridPanel df = new DefaultGridPanel(para1, para2);    // Issue is in this.
           }
      }
  }
  </code></pre>
  
  <p>DefaultGridpanel.java</p>
  
  <pre><code>public class DefaultGridPanel{
  
       @Inject
       private transient Provider &lt; ApplicationInstance &gt; appInstanceProvider;
  
       public DefaultGridPanel(){
          //
          //Constructor Some intialization
          System.out.print(appInstanceProvider);
          setPageSize(getRecordsPerPage());
      }
  
      private Integer getRecordsPerPage() {
          ApplicationInstance appInstance = appInstanceProvider.get();
     //------------Here-------------
     // appInstanceProvider getting null and throwing nullpointerException.
          Integer recordsPerPage = 0;
          if (appInstance != null) {
              recordsPerPage = appInstance.getRecordsPerPage();
          }
          if (recordsPerPage != null &amp;&amp; recordsPerPage &gt; 0) {
              return recordsPerPage;
          }
          else {
              return Preferences.DEFAULT_RECORDS_PER_PAGE;
          }
      }
  
  }
  </code></pre>
  
  <p>Why I am not able initialized appInstanceProvider with @Inject
  For This I am writing J unit </p>
  
  <p>Approach 1) I am calling <strong>method_A</strong> with create new object.
  I go through many questions on stack overflow and blogs.</p>
  
  <p>I got that new Keyword will not able help me too work on with @Inject</p>
  
  <p>Approach 2) I have try to override configure() and in that bind the appInstanceProvider. but still I am getting null.</p>
  
  <p>Kindly tell me any kind of new approach or work around.</p>