标签:idm maven工程 就是 als 目录 coding div rect dtd
工程下mapper.xml和mapper.java都存在切名称都对应
我习惯将mapper的xml和java都放在中的同一目录下
网上看了各种办法均失败
1 <?xml version="1.0" encoding="UTF-8"?> 2 <!DOCTYPE mapper 3 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 4 "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 5 <mapper namespace="mapper"> 6 <select id="findUserByIdMapper" parameterType="int" resultType="ssm.po.User"> 7 select *from user where id=#{id} 8 </select> 9 </mapper>
这是改之前的代码,问题出在<mapper namespace="mapper"> 原来mapper代理开发的xml文件中namespace不能乱写,必须用对应mapper.java的全路径,也就是Ctrl要点的进去.
因为用的是Maven构建,在pom.xml的<build></build>标签中添加如下代码即可
<resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> <resource> <directory>src/main/resources</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> </resources>
问题解决!
在Maven工程下Spring和Mybatis整合出现Invalid bound statement (not found):错误
标签:idm maven工程 就是 als 目录 coding div rect dtd
原文地址:https://www.cnblogs.com/haoxiansen/p/8847710.html