请问mybatis说找不到方法是怎么回事?明明没错,路径我对了好多次了 没有错,就是找不到findById
可能是 Mapper xml 文件没有被扫到,如果你使用的是 mybatis-spring-boot-starter,那么只需要在 application.properties 文件中配置 mybatis.mapper-locations=classpath:mybatisMapper/*.xml
就好了。
dao:
User findById(@Param("id") String id);
xml:
select xxx from user
<where>
<if test="id != null and id != ''">
and id=#{id}
</if>
</where>
这样试试
哪儿给你说 找不到findById了
参数不对
参数加上@Param("id")注解
mybatis配置类看下