SpringBoot:2.1.8.RLEASE(截止2019.9.28)java
JDK:JDK1.8及以上web
Spring:5.1.9.RELEASE及以上spring
支持編譯工具以下:bash
編譯工具 | 版本 |
---|---|
Maven | 3.3+ |
Gradle | 4.4+ |
支持的內嵌Servlet容器:app
名稱 | Servlet版本 |
---|---|
Tomcat 9.0 | 4.0 |
Jetty 9.4 | 3.1 |
Undertow 2.0 | 4.0 |
使用網站start.spring.io/在線建立項目maven
刪除導入項目自動生成的xxx.iml ,而後刷新下右側maven tab便可 spring-boot
添加Pom文件工具
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.8.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
複製代碼
在src/java目錄下建立包,並建立啓動類FisrtApplication網站
package com.xyz;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@SpringBootApplication
public class FirstApplication{
public static void main(String[] args) {
SpringApplication.run(FirstApplication.class, args);
}
@RequestMapping("/hello")
public String Hello() {
return "hello";
}
}
複製代碼
啓動項目,訪問:http://localhost:8080/hello
,返回ui
點擊File-->New-->Project