問題描述:
“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掃描