title: Multithread Spring-boot controller method
body: <p>So my application (spring-boot) runs really slow as it uses Selenium to scrape data, processes it and displays in the home page. I came across multithreading and I think it can be useful to my application to allow it to run faster, however the tutorials seem to display in the setting of a normal java application with a main. How can I multithread this single method in my controller?</p>
  <p>The methods get.. are all selenium methods. I'm looking to run these 4 lines of code simultaneously</p>
  <pre><code>   @Autowired
          private WebScrape webscrape;
      
      @RequestMapping(value = &quot;/&quot;)
      public String printTable(ModelMap model) {
          model.addAttribute(&quot;alldata&quot;, webscrape.getAllData());
          model.addAttribute(&quot;worldCases&quot;, webscrape.getWorlValues().get(0));
          model.addAttribute(&quot;worldDeaths&quot;, webscrape.getWorlValues().get(1));
          model.addAttribute(&quot;worldPop&quot;, webscrape.getWorlValues().get(2));
  
          return &quot;index&quot;;
      }
  </code></pre>