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映射文件还没写,先删掉。。