2021年1月25日 | Leave a comment 问题: java.lang.IllegalArgumentException: XML fragments parsed from previous mappers does not contain value for ***** A.xml 中定义了 <mapper namespace="dao.CommonSQLMapper"> <!-- order by displayorder asc, create_time desc --> <sql id="orderClausePageOrder"> order by #{order} <choose> <when test=" 'descending' == sort"> desc </when> <when test=" 'asc' == sort"> asc </when> </choose> </sql> 12345678910111213 <mapper namespace="dao.CommonSQLMapper"> <!-- order by displayorder asc, create_time desc --> <sql id="orderClausePageOrder"> order by #{order} <choose> <when test=" 'descending' == sort"> desc </when> <when test=" 'asc' == sort"> asc </when> </choose> </sql> BMapper.xml 中使用 <include refid="dao.CommonSQLMapper.orderClausePageOrder"/> 1 <include refid="dao.CommonSQLMapper.orderClausePageOrder"/> 解决: A.xml 在spring boot 中未加载 ,改名为 AMapper.xml 以便 spring boot 中加载 application.yml mybatis: mapper-locations: mapper/*Mapper.xml 12 mybatis: mapper-locations: mapper/*Mapper.xml 参考: