1.自动生成的mapping下的xml中提示表不存在
在设置中选择具体的数据库
2.生成的xml中sql语句的id报错
<statement> or DELIMITER expected, got 'id'
在setting中设置如下,具体是去掉sql|
3.@MapperScan报错,导入不了
pom.xml中添加,版本低也许不行
org.mybatis
mybatis-spring
2.0.6
4.实现的时候,一般不是导入的不准确
@Autowired//这里会报错,但是并不会影响,或者搜索进行报错降级修改
private FamilyTreeMapper fMapper;
报错Could not autowire. No beans of 'FamilyTreeMapper' type found.
5.启动报错
Invalid default: public abstract java.lang.Class org.mybatis.spring.annotation.MapperScan.factoryBean()
添加依赖:
org.mybatis.spring.boot
mybatis-spring-boot-starter
1.1.1
6.
org.springframework.boot.bind.RelaxedDataBinder错误
更新版本
com.alibaba
druid-spring-boot-starter
1.1.21
7.
-java.lang.NoSuchMethodError: org.apache.ibatis.session.Configuration
添加依赖
org.mybatis
mybatis
3.5.3
org.mybatis
mybatis-spring
2.0.6
8.
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause
检查controller上的注解
controller中service的声明注解。
还有就是排查注解。
9.
Invalid bound statement (not found): com.haopeople.mapper.FamilyTreeMapper.selectByPrimaryKey
检查配置文件
mybatis:
mapper-locations: classpath:mapping/*Mapper.xml #注意:一定要对应mapper映射xml文件的所在路径
type-aliases-package: com.haopeople.entity # 注意:对应实体类的路径
启动类上的注解
@MapperScan("com.haopeople.mapper")//将项目中对应的mapper类的路径加进来就可以了
@SpringBootApplication