title: Loosing setted instance / null after method ending (@Autowire)
body: <p>Im trying to set parser depend on URI.
  I was debugging it. 
  When condition is OK my parserParent is setted, but at the end of setParser() method, parserParent is again null. I was trying to combine with asigning @Autowired annotation in inherit class, but always Im getting the same NullPointer error. 
  How to fix it ? </p>
  
  <p>CLASS WHERE PROBLEM IS</p>
  
  <pre><code>import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.web.bind.annotation.GetMapping;
  import org.springframework.web.bind.annotation.PathVariable;
  import org.springframework.web.bind.annotation.RestController;
  import pl.manciak.excelparser.ParseAndSave.ParseCsvAndSaveToDB;
  import pl.manciak.excelparser.ParseAndSave.ParseXlsxAndSaveToDb;
  import pl.manciak.excelparser.ParseAndSave.ParserParent;
  
  import java.io.IOException;
  
  @RestController
  public class RestClientSave {
  
      private ParserParent parserParent;
      private ParseCsvAndSaveToDB parseCsvAndSaveToDB;
      private ParseXlsxAndSaveToDb parseXlsxAndSaveToDb;
  
      private String whichParser= "csv"; //HARDCODED FOR SIMPLICITY
  
      @Autowired
      public void setParser( ParseCsvAndSaveToDB parseCsvAndSaveToDB,
                             ParseXlsxAndSaveToDb parseXlsxAndSaveToDb) {
  
          if (whichParser.equals("csv")) {
               parserParent = parseCsvAndSaveToDB; // HERE PARSER IS SETTED
          }else if(whichParser.equals("xlsx")) {
              this.parserParent = parseXlsxAndSaveToDb;
          }
      } 
  
      @GetMapping("/save/{whichParser}")
      public String save(@PathVariable String whichParser) throws IOException {
          this.whichParser= whichParser;
          setParser( parseCsvAndSaveToDB, parseXlsxAndSaveToDb); // HERE IS AGAIN NULL
          parserParent.save();
          return "data saved";
      }
  }
  </code></pre>
  
  <p>PARENT CLASS FOR PARSER</p>
  
  <pre><code>import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Service;
  import pl.manciak.excelparser.DataService;
  import pl.manciak.excelparser.Entity.LinesEntity;
  import pl.manciak.excelparser.Entity.MapEntity;
  
  import java.io.IOException;
  import java.util.ArrayList;
  import java.util.HashMap;
  
  @Service
  public class ParserParent {
  
      protected DataService dataService;
      protected LinesEntity linesEntity;
      protected ArrayList&lt;String&gt; list;
  
      protected HashMap&lt;Long, LinesEntity&gt; xlsMapped = new HashMap&lt;&gt;();
      protected MapEntity mapEntity = new MapEntity();
  
      @Autowired
      public ParserParent(DataService dataService ) {
          this.dataService = dataService;
      }
  
      public void save() throws IOException {}
  
  }
  
  </code></pre>
  
  <p>CHILD CLASS</p>
  
  <pre><code>package pl.manciak.excelparser.ParseAndSave;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Service;
  import pl.manciak.excelparser.DataService;
  import pl.manciak.excelparser.Entity.LinesEntity;
  
  import java.io.*;
  
  import java.util.ArrayList;
  
  import java.util.Collections;
  
  @Service
  public class ParseCsvAndSaveToDB extends ParserParent{
  
      @Autowired
      public ParseCsvAndSaveToDB(DataService dataService) {
          super(dataService);
      }
  
      public void save() throws IOException {
  
           //Stream to Read Csv file
          FileReader fileReader = new FileReader("usda_sample.csv");
          BufferedReader br = new BufferedReader(fileReader);
  
          //read first line
          String line = br.readLine();
  
          long mapKey = 0;
  
              while (line != null) {
  
                  linesEntity = new LinesEntity(); // create a new LinesEntity for this loop execution
                  list = new ArrayList&lt;&gt;();
                  Collections.addAll(list, line.split(","));
                  line = br.readLine();
                  linesEntity.setSingleLine(new ArrayList&lt;&gt;(list));
                  dataService.saveOne(linesEntity);
                  xlsMapped.put(mapKey, linesEntity);
  
                  mapKey++;
              }
          mapEntity.setMapa(xlsMapped);
  
          System.out.println(xlsMapped);
  
          dataService.save(mapEntity);
  
      }
  
  </code></pre>