首页 > 移动平台 > 详细

启动项目报错:Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext.xml]:Invocation of init method failed

时间:2021-07-23 16:05:10      阅读:38      评论:0      收藏:0      [点我收藏+]

1.Error creating bean with name ‘sqlSessionFactory‘ defined in class path resource [applicationContext.xml]:Invocation of init method failed

 

 

2.错误 [main] - 将映射器“interface com.spring.mapper.UserMapper”添加到配置时出错。

Error parsing Mapper XML. The XML location is ‘com/spring/mapper/UserMapper.xml‘. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias

 

解决:mapper.xml文件传入参数的类型或者返回值类型是User类型时,要具体到包名.User,包名要写对

<mapper namespace="com.spring.mapper.UserMapper">
  <insert id="addUser" parameterType="com.spring.pol.User">
    insert into user(id,name,password,email,birthday)
    value(#{id},#{name},#{password},#{email},#{birthday})
  </insert>

  <select id="findUser" parameterType="String"
    resultType="com.spring.pol.User">
    select * from user
    where username = #{username}
    and password = #{password}
  </select>

  <select id="findUserByName" parameterType="String"
    resultType="com.spring.pol.User">
    select * from user
    where username = #{username}
  </select>

</mapper>

 

 

3. Error while adding the mapper ‘interface com.spring.mapper.BookMapper‘ to configuration.

BookMapper映射文件还没写,先删掉。。

启动项目报错:Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext.xml]:Invocation of init method failed

原文:https://www.cnblogs.com/xingzhixing/p/15048790.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!