一.创建工程

创建名称为"springboot_helloworld"的spring boot工程, new->Spring Starter Project,直接上图

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

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

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

点击“Finish”后需要耐心等待,这时Maven会自动下载所需spring boot的依赖包。所有的依赖如下:

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

二.开始编码

2.1 新建WebController

[html] view plain copy
  1. package com.woniu.controller;  
  2.   
  3. import org.springframework.web.bind.annotation.RequestMapping;  
  4. import org.springframework.web.bind.annotation.RestController;  
  5.   
  6. @RestController  
  7. @RequestMapping(value="/index")  
  8. public class WebController {  
  9.       
  10.     @RequestMapping(value="/hello")  
  11.     public String helloworld(){  
  12.         return "hello world!";  
  13.     }  
  14. }  

2.2 启动工程

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

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

三.测试

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

相关文章:

  • 2021-12-13
  • 2021-04-26
  • 2021-11-15
  • 2022-01-05
  • 2022-01-09
  • 2021-05-31
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-26
  • 2021-05-22
  • 2021-12-04
相关资源
相似解决方案