The build process

1. Create a project, as shown in the following figure. Choose one of (1) or (2) builds.

  • (1) Create New Project

  • (2) the File – > New – > Project

2. Select Spring Initializr.

3. Fill in Group, Artifact and Name and click Next as shown below.

4. Select required components: Basic components include Web and Web Server in Web module, MySQL, JDBC and Mybatis in SQL module, and additional components can be selected according to requirements.

5. Determine the project name and the project storage path.

6. Click Finish. The entire project architecture is shown below.

  • Pom.xml, Maven’s configuration file.
<? The 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 > < the parent > < groupId > org. Springframework. Boot < / groupId > The < artifactId > spring - the boot - starter - parent < / artifactId > < version > 2.4.5 < / version > < relativePath / > <! -- lookup parent from repository --> </parent> <groupId>com.gold</groupId> <artifactId>gj-tmall</artifactId> <version>0.0.1-SNAPSHOT</version> <name> GJ-tmall </name> <description> Build SpringBoot project </description> <properties> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </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>Copy the code
  • Application. Yml, empty project configuration file.

7. Create a new class helloController.java to test

HelloController.java

package com.gold.tmall.controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; /** * @author zhang.fuiqng * @date 2021-04-18 17:22:00 */ @RestController public class HelloController { /** * Hello SpringBoot * @return Hello SpringBoot */ @GetMapping(value = "/hello") public String hello() { return "Hello SpringBoot"; }}Copy the code

8, start running, browser access

Browser access:http://localhost:8080/helloIf the access succeeds, Hello SpringBoot is displayed.

Download the source code

Gitee.com/zhang_fuqin…