1.测试时如果只是简单的测试类,则需要访问配置文件,即以下步骤:
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("config/spring*//*");
// UserService userService = applicationContext.getBean(UserService.class);
UserDao userDao = applicationContext.getBean(UserDao.class);
userDao.dodd();
如果是在tomcat中启动则只需要在web.xml文件配置spring指定路径即可