cn.springmvc.service.impl.AFDCityServiceImpl cannot be cast to cn.springmvc.service.AFDCityService
cn.springmvc.service.impl.AFDCityServiceImpl cannot be cast to cn.springmvc.service.AFDCityService
AFDCityServiceImpl AFDCityServiceImpl;
@Before
public void before() {
@SuppressWarnings("resource")
ApplicationContext context = new ClassPathXmlApplicationContext(
new String[] { "classpath:conf/spring.xml", "classpath:conf/spring-mybatis.xml" });
/// classpath:conf--->放在了src/main/resources/conf下
AFDCityServiceImpl =(cn.springmvc.service.impl.AFDCityServiceImpl) context.getBean("AFDCityServiceImpl");//改了这里
}
@Test
public void addCity() {
AFDCityInfo afdCityInfo = new AFDCityInfo();
afdCityInfo.setName("dsadsjak");
afdCityInfo.setAreaId("35321325321311445");
System.out.println(AFDCityServiceImpl.insert(afdCityInfo));//改了这个
System.out.println("恰如 成功");
}