I have a main class in which i am creating object of a class which connects to the database. How can i use this object in a controller class ?
public class A {
public static void main(String[] args) {
// TODO Auto-generated method stub
connectToDb x=new connectToDb(); // makes a connection to database
}
now i want to use this object in spring controller class which has a method
@RequestMapping(value = "/whatever/, method = RequestMethod.GET)
public @ResponseBody Object getFilteredLogs() {
....
}
so how can i use that object in this controller class ?