mybatis注解配置

删除映射配置文件
在dao方法上用@Select()注解

 @Select("select *from user")
    List<User> findAll();

将SqlMapConfig.xml中的mapper标签修改为

  <mapper class="cn.mybatis.dao.IUserDao"/>

class=class属性指定被注解的dao全限定类名

你可能感兴趣的:(mybatis,java)