其他分享
首页 > 其他分享> > SpingBoot整合Mybatis

SpingBoot整合Mybatis

作者:互联网

一、创建springboot项目并导入相关依赖

   

<dependency>

<groupId>com.alibaba</groupId>

<artifactId>druid-spring-boot-starter</artifactId>

<version>1.1.10</version>

</dependency>

   

<dependency>

<groupId>mysql</groupId>

<artifactId>mysql-connector-java</artifactId>

<scope>runtime</scope>

<version>5.1.27</version>

</dependency>

   

注:maven建议把mybatis的xml文件(也是mybatis查询写sql语句的xml)放在recourse文件下,所以运行的时候会跳过src/main/java下的xml,所以加上如下配置

   

<resources>

<resource>

<directory>src/main/java</directory>

<includes>

<include>**/*.xml</include>

</includes>

</resource>

<resource>

<directory>src/main/resouce</directory>

</resource>

</resources>

标签:xml,src,resource,SpingBoot,dependency,整合,Mybatis,main,resources
来源: https://www.cnblogs.com/fernfei/p/12112039.html