1.new project 如下:

2.next 到下一步    對應的專案名,包名可以改一下

3.下一步  對應web 以及 如圖 SQL勾選一下  

4. 下一步  如圖所示 ,點選完成   載入完成 ,此時右側有64個架包

5.配置pom.xml檔案   載入完成後有76個架包

<!-- 分頁外掛 -->
		<dependency>
			<groupId>com.github.pagehelper</groupId>
			<artifactId>pagehelper-spring-boot-starter</artifactId>
			<version>1.2.5</version>
		</dependency>
		<!-- alibaba的druid資料庫連線池 -->
		<dependency>
			<groupId>com.alibaba</groupId>
			<artifactId>druid-spring-boot-starter</artifactId>
			<version>1.1.9</version>
		</dependency>
		<dependency>
			<groupId>org.mybatis.generator</groupId>
			<artifactId>mybatis-generator-core</artifactId>
			<version>1.3.2</version>
		</dependency>
		<!--jsp依賴,試圖解析器使用-->
		<dependency>
			<groupId>org.apache.tomcat.embed</groupId>
			<artifactId>tomcat-embed-jasper</artifactId>
			<scope>compile</scope>
		</dependency>
		<!--熱更新,熱載入,不用每次重啟啟動類-->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
			<optional>true</optional>
			<scope>true</scope>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-lang3</artifactId>
			<version>3.3.2</version>
		</dependency>
	</dependencies>

	<build>
		<!--把xml對映檔案強制性集合到專案釋出到tomcat伺服器-->
		<resources>
			<resource>
				<directory>src/main/java</directory>
				<includes>
					<include>**/*.xml</include>
					<include>**/*.properties</include>
				</includes>
				<filtering>false</filtering>
			</resource>
			<resource>
				<directory>src/main/resources</directory>
				<includes>
					<include>**/*.xml</include>
					<include>**/*.properties</include>
				</includes>
				<filtering>false</filtering>
			</resource>
		</resources>
		<plugins>

			<!--mybatis自動生成器的 外掛開始-->
			<plugin>

				<groupId>org.mybatis.generator</groupId>
				<artifactId>mybatis-generator-maven-plugin</artifactId>
				<version>1.3.2</version>
				<configuration>
					<!--配置檔案的位置-->
					<configurationFile>src/main/resources/templates/mybatis-generator-config.xml</configurationFile>
					<verbose>true</verbose>
					<overwrite>true</overwrite>
				</configuration>
				<executions>
					<execution>
						<id>Generate MyBatis Artifacts</id>
						<goals>
							<goal>generate</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<!--mybatis自動生成器的 外掛結束-->

7. 在main下面建一個webapp資料夾

8. 選中Facets 配置webapp檔案

9.建立如下包名

10.在templates裡面配置mybatis-generator-config.xml檔案

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
        PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
        "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">

<generatorConfiguration>
    <!--1mysql 連線資料庫jar 這裡選擇自己本地位置-->
    <classPathEntry location="C:/Users/Administrator/.m2/repository/mysql/mysql-connector-java/5.1.29/mysql-connector-java-5.1.29.jar" />
    <context id="testTables" targetRuntime="MyBatis3">
        <commentGenerator>
            <!-- 2是否去除自動生成的註釋 true:是 : false:否 -->
            <property name="suppressAllComments" value="true" />
        </commentGenerator>
        <!--3資料庫連線的資訊:驅動類、連線地址、使用者名稱、密碼 -->
        <jdbcConnection driverClass="com.mysql.jdbc.Driver"
                        connectionURL="jdbc:mysql://localhost:3306/emp"
                        userId="root"
                        password="root">
        </jdbcConnection>
        <!-- 預設false,把JDBC DECIMAL 和 NUMERIC 型別解析為 Integer,為 true時把JDBC DECIMAL 和
           NUMERIC 型別解析為java.math.BigDecimal -->
        <javaTypeResolver>
            <property name="forceBigDecimals" value="false" />
        </javaTypeResolver>

        <!-- 4targetProject:生成PO類的位置 -->
        <javaModelGenerator targetPackage="com.test.po"
                            targetProject="src/main/java">
            <!-- enableSubPackages:是否讓schema作為包的字尾 -->
            <property name="enableSubPackages" value="false" />
            <!-- 從資料庫返回的值被清理前後的空格 -->
            <property name="trimStrings" value="true" />
        </javaModelGenerator>
        <!-- 5targetProject:mapper對映檔案生成的位置
           如果maven工程只是單獨的一個工程,targetProject="src/main/java"
           若果maven工程是分模組的工程,targetProject="所屬模組的名稱",例如:
           targetProject="ecps-manager-mapper",下同-->
        <sqlMapGenerator targetPackage="com.test.dao"
                         targetProject="src/main/java">
            <!-- enableSubPackages:是否讓schema作為包的字尾 -->
            <property name="enableSubPackages" value="false" />
        </sqlMapGenerator>
        <!-- 6targetPackage:mapper介面生成的位置 -->
        <javaClientGenerator type="XMLMAPPER"
                             targetPackage="com.test.dao"
                             targetProject="src/main/java">
            <!-- enableSubPackages:是否讓schema作為包的字尾 -->
            <property name="enableSubPackages" value="false" />
        </javaClientGenerator>
        <!-- 7指定資料庫表 -->
        <table  tableName="emp"
                enableCountByExample="false"
                enableDeleteByExample="false"
                enableSelectByExample="false"
                enableUpdateByExample="false"
        >
            <property name="modelOnly" value="false" />
        </table>
        <table
                tableName="dept"
                enableCountByExample="false"
                enableDeleteByExample="false"
                enableSelectByExample="false"
                enableUpdateByExample="false"
        >
            <property name="modelOnly" value="false" />
        </table>
        <!--example:https://blog.csdn.net/sinat_30474567/article/details/72625651-->
    </context>
</generatorConfiguration>

10.在pom.xml中把檔案配置路徑改一下 如圖

11.配置application.properties檔案

#mybatis起別名
mybatis.type-aliases-package=com.test.po
#jdbc
#spring.datasource.driver-class-name=com.mysql.jdbc.Driver
#spring.datasource.url=jdbc:mysql://localhost:3306/emp?useUnicode=true&zeroDateTimeBehavior=convertToNull&autoReconnect=true
#spring.datasource.username=root
#spring.datasource.password=root

#spring-boot整合Druid
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.url=jdbc:mysql://localhost:3306/emp?allowMultiQueries=true&autoReconnect=true 
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driverClassName=com.mysql.jdbc.Driver

#dataSource Pool configuration
spring.datasource.initialSize=5
spring.datasource.minIdle=5
spring.datasource.maxActive=20
spring.datasource.maxWait=60000
spring.datasource.timeBetweenEvictionRunsMillis=60000   
spring.datasource.minEvictableIdleTimeMillis=300000
spring.datasource.validationQuery=SELECT 1 FROM DUAL
spring.datasource.testWhileIdle=true
spring.datasource.testOnBorrow=false
spring.datasource.exceptionSorter=true
spring.datasource.testOnReturn=false
spring.datasource.poolPreparedStatements=true
spring.datasource.filters=stat,wall,log4j
spring.datasource.maxPoolPreparedStatementPerConnectionSize=20
spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500
spring.datasource.useGlobalDataSourceStat=true



#設定jsp 訪問資源字首
spring.mvc.view.prefix=/WEB-INF/views/
#設定jsp 訪問資源字尾
spring.mvc.view.suffix=.jsp

11.在Springboot03Application資料夾中加入如下語句

12. 13.執行一下Unnamed

自動建立po層和dao層

12.如圖執行 

即為配置成功

13.配置熱啟動外掛

快捷鍵ctrl+shift+A

如上圖所示,配置完成