cn.springmvc.service.impl.AFDCityServiceImpl cannot be cast to cn.springmvc.service.AFDCityService

来源:互联网 发布:合作软件开发平台 编辑:程序博客网 时间:2024/05/20 23:40

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("恰如 成功");
}




0 0