springboot mybaties Invalid bound statement (not found) 错误

错误信息:

 org.apache.catalina.connector.RequestFacade@5151cc1f, 
    org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): 
    com.test.frame.demo.domain.mapper.clusterMapper.UserMapper.getUserList

错误原因:
spring boot里面的mapper和mubaties里面的mapper的方法没对应上。
排查步骤:
1.看spring的mapper是否有注解mapper

import org.apache.ibatis.annotations.Mapper;
@Component
@Mapper  

2.查看xml文件内spring boot 的mapper类和mybaties的xml文件的映射路径是否正确

 //对应Mapper的包名称
 static final String PACKAGE = "com.test.frame.demo.domain.mapper.clusterMapper";
 //对应配置的xml文件的路径    mapper/**/*.xml
 static final String MAPPER_LOCATION = "classpath:mapper/cluster/**/*.xml";

3.上面都没问题,那就看mybaties对应的文件里面的标签设置的mapper路径是否对




4.在就是查看mybaties文件的xml文件里面是否有你要调用的方法


    
       insert  into  demousers set name =#{name,jdbcType=VARCHAR},age=#{age,jdbcType=INTEGER}
    


你可能感兴趣的:(spring,boot)