ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
案例代码:https://gitee.com/flymini/codes01/tree/master/springboot_/com-learn-boot01 **** **1. 环境要求** ``` jdk8+、Maven3.3+、Tomcat9.0+ ``` **2. 创建SpringBoot项目** ![](https://img.kancloud.cn/ea/9f/ea9fb1abc8547df97585208dcf9bcb87_1598x801.jpg) ![](https://img.kancloud.cn/80/b8/80b8821d09d18c6305e790519548ce69_1597x536.jpg) **3. pom.xml** ```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.3.12.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.learn.example</groupId> <artifactId>com-learn-boot01</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <name>com-learn-boot01</name> <description>com-learn-boot01</description> <properties> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project> ``` **4. 项目目录结构** ``` |—— 项目名 | |—— src | | |—— main | | | |—— java | | | | |—— com.learn.boot01.Boot01Application #启动类,项目启动的入口 | | | |—— resources | | | | |—— static #放一些静态资源,js、css、图片等 | | | | |—— templates #放所有的模板页面,如 .html,.tfl文件 | | | | |—— application.properties #SpringBoot核心配置文件 | | |—— test #专门用于测试的代码 | | | |—— java.com.learn.boot01.Boot01ApplicationTests | |—— target | |—— pom.xml ``` **5. 点击启动类启动项目** ![](https://img.kancloud.cn/56/a3/56a35b17157faf8dfead119ff04a0360_1888x558.jpg)