1、点击新建项目
2、选择springboot项目,选择jdk版本
3、选择Java版本和写包名
4、引入web依赖(这里可以不引入,后面一起和mybatis一起引入也可)
5、项目位置
6、在pom.xml引入mybatis依赖,引入后要刷新maven
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
7、配置mybatis
spring:
datasource:
url: jdbc:mysql://localhost:3306/qcby_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=CTT
username: root
password:
driver-class-name: com.mysql.cj.jdbc.Driver
mybatis:
mapper-locations: classpath:mapper/*.xml #对应mapper映射xml文件所在路径
type-aliases-package: com.xxxx.entity #对应实体类路径
8、新建Controller等层和mapper的xml....