<?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.example.demo.mapper.UserInfoMapper">
</mapper>
namespace后面接的是要实现的类名,要将其写全;使用时可以直接复制粘贴替换掉
例如UserInfoXmlMapper类如下时
package com.example.mybatislearn.mapper;
import com.example.mybatislearn.model.UserInfo;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface UserInfoXmlMapper {
List<UserInfo> queryUserList();
}
此时将mapper.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.example.mybatislearn.mapper.UserInfoXmlMapper">
</mapper>