SpringBoot 項(xiàng)目創(chuàng)建

以下是創(chuàng)建簡(jiǎn)單Spring Boot項(xiàng)目的步驟。

步驟1: 打開Spring initializr https://start.spring.io 。

步驟2: 提供 工件名稱。我們提供了組名 com.nhooo 和工件 spring-boot-example 。

步驟3: 現(xiàn)在,點(diǎn)擊 Generate (生成)。

創(chuàng)建Spring Boot項(xiàng)目

何時(shí)我們單擊"生成"按鈕,它將開始將項(xiàng)目打包為 .rar 文件并下載該項(xiàng)目。

步驟4: 提取 RAR 文件。

步驟5: 導(dǎo)入文件夾。

文件->導(dǎo)入->現(xiàn)有Maven項(xiàng)目->下一步->瀏覽->選擇項(xiàng)目->完成

導(dǎo)入需要一些時(shí)間該項(xiàng)目。成功導(dǎo)入項(xiàng)目后,我們可以在 Package Explorer 中查看項(xiàng)目目錄。下圖顯示了項(xiàng)目目錄:

正在創(chuàng)建Spring Boot項(xiàng)目

SpringBootExampleApplication .java

package com.nhooo.springbootexample;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringBootExampleApplication 
{
public static void main(String[] args) 
{
SpringApplication.run(SpringBootExampleApplication.class, args);
}
}

pom.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.2.2.BUILD-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.nhooo</groupId>
<artifactId>spring-boot-example</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>spring-boot-example</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</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>

步驟6: : 運(yùn)行 SpringBootExampleApplication.java 文件。

右鍵單擊該文件->運(yùn)行方式-> Java應(yīng)用程序

正在創(chuàng)建Spring Boot項(xiàng)目

下圖顯示了應(yīng)用程序已成功運(yùn)行。

創(chuàng)建Spring Boot項(xiàng)目


丰满人妻一级特黄a大片,午夜无码免费福利一级,欧美亚洲精品在线,国产婷婷成人久久Av免费高清