Error creating bean with name 's
2022-03-10 本文已影响0人
kevinXiao
报错信息:org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlSessionFactory’ defined in URL [jar:file:/E:/Maven/maven_repository/com/tengyouhui/tyh-manager-dao/1.0-SNAPSHOT/tyh-manager-dao-1.0-SNAPSHOT.jar!/spring/spring-dao.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/classpath*:mybatis/SqlMapConfig.xml]
image.png创建SqlSessionFactoryBean对象时,配置mapperLocations属性加载其他Mybatis文件时,属性的值一定不要写classpath*,只能写classpath,否则就出现上面的错误