Create a new project using Spring Initializr
To create a new Spring Boot project, it is recommended to use Spring Initializr. Creating a project in this way requires a network connection, which automatically queries the current version and component list of Spring Boot.
1. In the idea interface, click File-->New-->Project in the menu bar in the upper left corner. Select Spring Initialize, select Project SDK 1.8, and click Next.
2. Enter GroupId and ArtifactId and click Next.
3. Check Web and click Next.
4. Enter the project name and project address and click Finish.
At this time, the Spring Boot project has been created and the sample program is included. Click the Run button in the upper right corner to run the project.
Create a new project using Maven
1. In the idea interface, click File-->New-->Project in the menu bar in the upper left corner. Select Maven, select Project SDK 1.8, and click Next.
2. Enter GroupId and ArtifactId and click Next.
Among them, GroupId is generally composed of domain + company, and domains are divided into org, com, cn, etc.
ArtifactId refers to the project name.
3. Enter the project name and project address and click Finish.
This creates a project, and then introduces the relevant jar of spring-boot in the pom.xml file under the project.
Complete pom.xml file
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>demo</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>demo</name> <description>Demo project for Spring Boot</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.3.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <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-test</artifactId> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build></project>
The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.