Spring Boot系列教程二:创建第一个web工程 hello world

一.创建工程

创建名称为"springboot_helloworld"的spring boot工程, new->Spring Starter Project,直接上图
 
 
 
 
点击“Finish”后需要耐心等待,这时Maven会自动下载所需spring boot的依赖包。所有的依赖如下:
 
                    

二.开始编码

2.1 新建WebController

 1 import org.springframework.web.bind.annotation.RequestMapping;
 2 import org.springframework.web.bind.annotation.RestController;
 3 
 4 @RestController
 5 @RequestMapping(value="/index")
 6 public class WebController {
 7     
 8     @RequestMapping(value="/hello")
 9     public String helloworld(){
10         return "hello world!";
11     }
12 }

2.2 启动工程

 
 

三.测试

原文地址:https://www.cnblogs.com/wdpnodecodes/p/7406525.html