Spring Boot 学习第一课
学习手册
https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/
入门指南
https://spring.io/guides/gs/spring-boot/
准备开始
- JDK1.8 +
- Gradle 2.3+ or Maven 3.0+
- IDE
- Spring Tool Suite (STS)
- Intellij IDEA
获取模板源码
可选以下三种方式 Optional
- git clone https://github.com/spring-guides/gs-spring-boot.git
- https://github.com/spring-guides/gs-spring-boot/archive/master.zip
- https://start.spring.io/
使用Intellij IDEA 开发指南
- 运行Intellij IDEA,点击 ’ Create New Project ’
2.如图所示:
3.如图所示:
4.如图所示:
5.如图所示:
6.点击Finish之后可以看到如下所示:
7.点击运行后可以看到这样的界面:
8.创建一个叫做HelloController的java 类
package com.xingyun.springbootwithmavensample;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@RestController
public class HelloController {
@RequestMapping(value = “/hi",method = RequestMethod.GET)
public String index(){
return "Hello World , Spring Boot";
}
}
重新运行,打开链接:http://127.0.0.1:8080/hi
源码下载地址:https://gitee.com/xingyuncode/SpringBootWithMavenSample