一.新建一个SpringBoot
构建准备
- jdk 1.8 或以上
- maven
- IntelliJ IDEA
打开Idea-> new Project ->Spring Initializr ->填写group、artifact ->钩上web(开启web功能)->点下一步就行了。
创建完工程,工程的目录结构如下:
- pom文件为基本的依赖管理文件
- resouces 资源文件
- statics 静态资源
- templates 模板资源
- application.properties 配置文件(后面更换成.yml)
- SpringbootApplication程序的入口
POM文件配置参考
<?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.2.0.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.springboot</groupId> <artifactId>mybatis</artifactId> <version>0.0.1-SNAPSHOT</version> <name>mybatis</name> <description>Demo project for Spring Boot</description> <properties> <java.version>1.8</java.version>