1. 程式人生 > >Spring與MyBatis整合錯誤:nested exception is java.lang.NoClassDefFoundError

Spring與MyBatis整合錯誤:nested exception is java.lang.NoClassDefFoundError

最近在學習整合Spring與MyBatis時,出現了以下異常:

Error creating bean with name 'sqlSessionFactoryBean' defined in class path resource [application-mybatis.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException;
Property 'dataSource' threw exception; nested exception is java.lang.NoClassDefFoundError

如果你的配置檔案仔細檢查之後都沒有問題的話,那麼這就是因為專案中缺少依賴包spring-jdbc-5.0.8.RELEASE.jar(任意版本皆可),匯入到專案中即可。

附上下載地址(Spring所有依賴包、與MyBatis整合所需要的所有依賴包)