1、 System requirements :
- Java 8 & compatible java14 .
- Maven 3.3+
- idea 2019.1.2
2、Maven Found in the installation directory conf The folder settings.xml file , Configure the following
<mirrors> <mirror> <id>nexus-aliyun</id> <mirrorOf>central</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror> </mirrors> <profiles> <profile> <id>jdk-1.8</id> <activation> <activeByDefault>true</activeByDefault> <jdk>1.8</jdk> </activation> <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion> </properties> </profile> </profiles>
3、 Reference resources SpringBoot2 Official documents , Implementation requirements : Browse and send /hello request , Respond to Hello,Spring Boot 2
3.1 Create a new one Maven project , stay pom.xml Middle configuration :
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.3.4.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies>
Here's the picture :
3.2 The right side uses Maven Download depends on resources
3.3 Create a main program class , Project entrance
3.4 Next you can write MVC Business logic has changed , First, create the control class , Use @RestController Notes to illustrate , Class is written to the browser ( The note contains @controller and @ResponseBody)
3.5 start-up SpringBoot: Run the main program code
If an error is found on the console during startup : The port is occupied by , Then reconfigure the port :
URL visit :