對Mybatis註解方式有興趣的,能夠查看個人另外一篇:Spring boot Mybatis 整合(註解版) 註解方式更加簡潔簡單,極大程度的提升了開發速度。java
Spring Boot快速入門
Spring Boot開發Web應用
Spring Boot工程結構推薦
Spring Boot構建RESTful API與單元測試
Spring Boot中使用Swagger2構建強大的RESTful API文檔
Spring Boot中使用JdbcTemplate訪問數據庫
Spring Boot中使用Spring-data-jpa讓數據訪問更簡單、更優雅
Spring Boot多數據源配置與使用
Spring Boot日誌管理
Spring Boot中使用Redis數據庫
Spring Boot中使用MongoDB數據庫
Spring Boot中Web應用的統一異常處理
Spring Boot屬性配置文件詳解
Spring Boot中使用@Scheduled建立定時任務
Spring Boot中使用@Async實現異步調用
Spring boot Mybatis 整合(註解版)
springboot事務管理詳解
springboot中使用Mybatis註解配置詳解mysql
本項目使用的環境:git
額外功能github
步驟:
1.建立一個springboot項目:
2.建立項目的文件結構以及jdk的版本
3.選擇項目所須要的依賴
而後點擊finishweb
5.看一下文件的結構:
spring
6.查看一下pom.xml:sql
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.winter</groupId> <artifactId>springboot-mybatis-demo</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>springboot-mybatis-demo</name> <description>Demo project for Spring Boot</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.6.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.7</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>1.3.0</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.35</version> </dependency> <!-- alibaba的druid數據庫鏈接池 --> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>1.0.11</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> </dependency> <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-joda</artifactId> </dependency> <dependency> <groupId>com.fasterxml.jackson.module</groupId> <artifactId>jackson-module-parameter-names</artifactId> </dependency> <!-- 分頁插件 --> <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter</artifactId> <version>1.1.2</version> </dependency> <!-- alibaba的druid數據庫鏈接池 --> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter