可以在servlet中的doGet或者doPost方法中,调用
AbstractApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
来获取spring容器中的类(component)。
例如:ctx.getBean("classname");
注意:applicationContext.xml,是你的spring配置文件
classname是spring容器里的类名,首字母小写