这里只需要选择一个web就好了
这地方一定要注意 一定要把包新建到com.example下面和Demo01Application同级
进入到Demo01Application项目主入口来运行
在浏览器输入http://localhost:8080/hello就可以看到hello word了
项目代码
package com.example.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class TestController { @RequestMapping("/hello") public String hello(){ return "hello word"; } }