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?
The methods get.. are all selenium methods. I'm looking to run these 4 lines of code simultaneously
@Autowired
private WebScrape webscrape;
@RequestMapping(value = "/")
public String printTable(ModelMap model) {
model.addAttribute("alldata", webscrape.getAllData());
model.addAttribute("worldCases", webscrape.getWorlValues().get(0));
model.addAttribute("worldDeaths", webscrape.getWorlValues().get(1));
model.addAttribute("worldPop", webscrape.getWorlValues().get(2));
return "index";
}