【错误解决】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扫描


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM