软件编程
位置:首页>> 软件编程>> java编程>> mybatis初始化SqlSessionFactory失败的几个原因分析

mybatis初始化SqlSessionFactory失败的几个原因分析

作者:南宫龙码  发布时间:2021-06-17 11:13:44 

标签:mybatis,初始化,SqlSessionFactory

mybatis初始化SqlSessionFactory失败

总结原因有几点

1.resources中的xml配置文件放错位置或者是放的太深加载不到

比如 RoleDao因为放的比较包中包中所以扫描不到

mybatis初始化SqlSessionFactory失败的几个原因分析

2.xml文件里面有错文

比如mapper namespace的相对路径有问题 导致初始化错误


mybatis初始化SqlSessionFactory失败的几个原因分析

SqlSessionFactory异常

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlSessionFactory' defined in class path resource [spring/applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: ‘class path resource [mybatis]'; nested exception is java.io.FileNotFoundException: class path resource [mybatis] cannot be opened because it does not exist

sqlSessionFactory配置文件路径错误

mybatis初始化SqlSessionFactory失败的几个原因分析


mybatis初始化SqlSessionFactory失败的几个原因分析

来源:https://blog.csdn.net/weixin_45365266/article/details/114322626

0
投稿

猜你喜欢

手机版 软件编程 asp之家 www.aspxhome.com