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