I am using Spring MVC for my web application. My beans are written in \"spring-servlet.xml\" file
spring-servlet.xml
Now I have a class MyClass and i want to
MyClass
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("/spring-servlet.xml");
Then you can retrieve the bean:
MyClass myClass = (MyClass) context.getBean("myClass");
Reference: springbyexample.org