- 1.文件——>新建
- 2.选择Spring Initializr,然后选择next
- 3.填写项目相关的信息
- 4
- 5
- 6 创建web包,并创建一个类IndexController
- 7.IndexController代码:
package com.springboot.web; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @Controller public class IndexController { @RequestMapping(value = "/say") public @ResponseBody String say(){ return "hello,springboot"; } }
- 8.运行
- 10访问以及结果
http://127.0.0.1/8080/say