For e.g. when I try to invoke the following method which is part of PersonController
@RequestMapping("/selectnamelbyid")
public Template selectNamesbyID(@RequestParam(value = "id") String id) {...
using the code below
PersonController personController = new PersonController();
personController.selectNamesbyID(id);
it throws a nullpointer. I am trying to centralize the data fetching logic to the controller class by doing this. Can someone tell what am I doing wrong?