共计 736 个字符,预计需要花费 2 分钟才能阅读完成。
~~~~spring 中整合 mybatis
myBatis 运行逻辑剖析
一,在 pom.xml 文件中增加所需依赖:
mysql 驱动依赖
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
spring jdbc 依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jdbc</artifactId>
</dependency>
mybatis starter 依赖
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.3</version>
</dependency>
二,在 application.properties 配置文件中增加繁难配置
连接池配置
spring.datasource.url=jdbc:mysql://localhost:3306/dbgoods?serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=root
mybatis 配置
mybatis.mapper-locations=classpath:/mapper/*/*.xml
正文完
发表至: springboot
2020-09-29