title: Autowired not working with TestNG Test Class
body: <p>I am unable to access an autowired class (ListService) located in a test class.  Outside of the test, I can successfully access the autowired class to make the following call: </p>
  
  <blockquote>
    <p>List schoolSubjectList =
    listService.getMathSubjectList();</p>
  </blockquote>
  
  <p>The above call results in a null pointer exception.</p>
  
  <p>Test Class:</p>
  
  <pre><code>...
  @Autowired
  ListService listService;
  
  @BeforeClass
  public void setUp(ITestContext context) throws Exception {
      Random random = new Random();
      int randomInteger = Math.abs(random.nextInt(1000));
  
      suiteParams = context.getSuite().getXmlSuite().getAllParameters();
  
      List&lt;SchoolSubjectDto&gt; schoolSubjectList = listService.getMathSubjectList();
      int sizeOfSchoolSubjectList = schoolSubjectList.size();
  
      ...
  </code></pre>