springboot整合mybatis过程与遇到的问题

引入pom依赖
springboot整合mybatis过程与遇到的问题

2.创建工程,这里我在原来基础上新建的package,跟demotest同级目录,appliation在demotest下,这个会引发一个错误,下边会描述。
1) 新建表
springboot整合mybatis过程与遇到的问题
2)创建如下文件类
springboot整合mybatis过程与遇到的问题
2)bean get set tosring 构造方法
springboot整合mybatis过程与遇到的问题
3)创建mapperspringboot整合mybatis过程与遇到的问题
4)springboot整合mybatis过程与遇到的问题
5)springboot整合mybatis过程与遇到的问题
6)springboot整合mybatis过程与遇到的问题
7)
springboot整合mybatis过程与遇到的问题
启动 springboot整合mybatis过程与遇到的问题
入表成功。

其中遇到两个问题
第一个异常:This application has no explicit mapping for /error, so you are seeing this as a fallback.
这个是因为appcation类所在的包应该包含所有子包,我开始的时候新建的放在同级目录导致的。
参考解决

第二个问题
Field userEntityMapper in com.xxx.xxx.service.UserService required a bean of type ‘com.xxx.xxx.PersonMapper’ that could not be found.

我修改了整个包的路径之后 忘了修改
mapper注解扫描的包了,这两个问题解决了,就没有问题了。
springboot整合mybatis过程与遇到的问题

相关文章: