【错误解决】BeanDefinitionStoreException: Failed to read candidate component class: file [mapper.class文件]; nested exception is java.lang.IllegalArgumentException

问题描述:

  “spring-mybatis整合,使用mapper代理开发,通过MapperScannerConfigurer进行mapper扫描”的练习中,出现异常:

  org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [E:\项目\mybatis_spring\bin\cn\itheima\ssm\mapper\UserMapper.class]; nested exception is java.lang.IllegalArgumentException

问题分析:

  我使用的spring是3.2版本的,而编译器是jdk1.8,根据spring官网的说法,要使用java8,只支持spring 4.X以上版本,而spring的使用最低java要求java5及以上,也就是说spring与编译器版本不匹配

问题解决:

  将项目使用的编译器改为1.7版本:

  选中项目右键->properties


通过MapperScannerConfigurer进行mapper扫描

posted @ 2018-10-28 17:19  炼钢工人  阅读(3019)  评论(0编辑  收藏  举报