Spring Boot 整合MyBatis

文章目錄

導入依賴

<dependency>
	<groupId>org.mybatis.spring.boot</groupId>
	<artifactId>mybatis-spring-boot-starter</artifactId>
	<version>2.1.0</version>
</dependency>

<dependency>
	<groupId>mysql</groupId>
	<artifactId>mysql-connector-java</artifactId>
	<scope>runtime</scope>
</dependency>

配置

application.properties

spring:
  datasource:
    username: root
    password: 123456
    url: jdbc:mysql://localhost:3306/myblog?useUnicode=true&characterEncoding=utf-8
    driver-class-name: com.mysql.jdbc.Driver
mybatis:
  type-aliases-package: com.blog.myblog.pojo
  mapper-locations: classpath:mybatis/mapper/*.xml

發佈了21 篇原創文章 · 獲贊 2 · 訪問量 4312
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章