aini5568314 2019-10-31 17:30 采纳率: 0%
浏览 148

这个错在那啊??????

1.网上的都试了
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.bjsxt.mapper.UsersMapper.selectUsersAll] with root cause

UsersMapper.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bjsxt.mapper">
    <resultMap id="BaseResultMap" type=" com.bjsxt.pojo.Users">
        <result column="id" property="id"></result>
        <result column="name" property="name"></result>
        <result column="age" property="age"></result>
    </resultMap>
<!--    <insert id="insertUser" parameterType="com.bjsxt.pojo.Users">-->
<!--        insert into users(id,name,age,password) values(#{id},#{name},#{age},#{password})-->
<!--    </insert>-->
    <select id="selectUsersAll"  resultMap="BaseResultMap">
         select * from user
     </select>
</mapper>

UserMapper.java

package com.bjsxt.mapper;

import com.bjsxt.pojo.Users;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface UsersMapper {
    void insertUser(Users users);
    List<Users> selectUsersAll();


}

图片说明

  • 写回答

3条回答 默认 最新

  • _鹿慕溪水 2019-10-31 17:45
    关注

    看看你的mapper文件,

    <mapper namespace="com.bjsxt.mapper">
    

    只指定到了你dao的包的位置,而没有指定到具体对应的dao接口,
    应该这样写

    <mapper namespace="com.bjsxt.mapper.UsersMapper">
    

    建议先多了解一下spring集成mybatis的文档说明,再开始写代码

    评论

报告相同问题?

悬赏问题

  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能