1.在resources下新建文件夹mapper/UserMapper.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.springboot.dao.UserDao">
<select id="queryUser" resultType="User">
select * from user
</select>
</mapper>
注:id和方法名相同,dao层和mapping名必须相同
2.application.properties
#配置Mybatis的扫描路径(注解形式需开启以下两个)/typeAliasesPackage:dao层路径/mapperLocations:mapper位置(resources下)
#mybatis.typeAliasesPackage=com.springboot.dao
#mybatis.mapperLocations=classpath:mapper/*.xml
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- igbc.cn 版权所有 湘ICP备2023023988号-5
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务