New Project
![](https://i-blog.csdnimg.cn/blog_migrate/eb46c8b306a33449d6e6e4ffc00c81fc.png)
![](https://i-blog.csdnimg.cn/blog_migrate/08d5a9343ae939ff7b4be39d64b71d22.png)
勾选自己项目需要的东西
![](https://i-blog.csdnimg.cn/blog_migrate/4a04602aa3a7cabda650435ce748993f.png)
![](https://i-blog.csdnimg.cn/blog_migrate/5d6d78f7c10c6d2441857fabef6ecc0b.png)
在pom.xml文件导入项目相关依赖
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.8</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>edu.lingnan</groupId>
<artifactId>owner</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>owner</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<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-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.47</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.7</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.0.6</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
<settings>
<setting name="mapUnderscoreToCamelCase" value="true"/>
</settings>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
配置application.yml
#配置tomcat的端口
server:
port: 8080
servlet:
context-path: / #访问的一级路径 localhost:8082/
#配置数据库的数据源
spring:
datasource:
url: jdbc:mysql://localhost:3306/owner?characterEncoding=utf8
password: 123456
username: root
driver-class-name: com.mysql.jdbc.Driver
#配置视图的前缀和后缀
mvc:
view:
prefix: /templates/ #前缀
suffix: .html #后缀
#配置静态资源的访问路径 localhost:8080/a/b/c
static-path-pattern: /** #配置静态资源的访问路径
web:
resources:
static-locations: classpath:/static #静态资源的映射路径
#配置MyBatis-plus
mybatis-plus:
type-aliases-package: cn.edu.lingnan.e_business_sys.before.pojo #配置类的别名
mapper-locations: classpath:mappers/*.xml #sql映射文件的位置
configuration:
map-underscore-to-camel-case: true #自动开启驼峰规则映射
建包,把系统分为mapper、service、serviceImpl、pojo、controller几层
![](https://i-blog.csdnimg.cn/blog_migrate/82b17441fd8c8f1902a8a84b797fb433.png)