1、idea选择File->Project
2、引入lombok、web、mysql驱动
3、修改spring boot版本为2.3.0.RELEASE,修改mysql版本为5.1.47,刷新maven。修改后的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.3.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>starter</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>00Starter</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-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
<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>
</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>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
4、运行application,控制台信息如下:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.3.0.RELEASE)
2021-12-24 14:32:20.024 INFO 11852 --- [ main] com.example.starter.Application : Starting Application on chenzl105390 with PID 11852 (E:\gitee\chenzhenlindx\schema-validation\00Starter\target\classes started by chenzl105 in E:\gitee\chenzhenlindx\schema-validation\00Starter)
2021-12-24 14:32:20.027 INFO 11852 --- [ main] com.example.starter.Application : No active profile set, falling back to default profiles: default
2021-12-24 14:32:20.696 INFO 11852 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2021-12-24 14:32:20.704 INFO 11852 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-12-24 14:32:20.704 INFO 11852 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.35]
2021-12-24 14:32:20.836 INFO 11852 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-12-24 14:32:20.836 INFO 11852 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 774 ms
2021-12-24 14:32:20.937 INFO 11852 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2021-12-24 14:32:21.035 INFO 11852 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2021-12-24 14:32:21.042 INFO 11852 --- [ main] com.example.starter.Application : Started Application in 1.304 seconds (JVM running for 2.773)
5、打开 http://localhost:8080/ 界面如下: