Springboot集成mybatis注解方式

来源:互联网 发布:人事管理系统源码 编辑:程序博客网 时间:2024/06/04 18:13

参考文献:

http://blog.csdn.net/gebitan505/article/details/54929287


使用的时候有两个要点:在测试的时候一直报这个错误,后来发现,是因为包名不一致的原因,在Springboot的Application类中上面注释寻找哪个包下的为mapper,所以test类中的包名也要与它一致,不然是无法成功的。

还有启动的时候一下就启动完了:是因为没有加web依赖:

<dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-web</artifactId>
   </dependency>


上源码地址:https://github.com/liuzhi0716/SpringBootMybatisTest

非常简单

原创粉丝点击