1.在spring-servlet.xml中配置
<!--业务类的配置-->
<bean id="locationTaskService" class="com.location.service.LocationTaskServiceImpl"></bean>
2.添加获取bean的代码
ApplicationContext ac=new ClassPathXmlApplicationContext("spring-servlet.xml");
LocationTaskService cd=(LocationTaskService) ac.getBean("locationTaskService");