1.创建app.groovy文件
文件名称:app.groovy
文件内容:
@Controller
class app{
@RequestMapping("/hello")
@ResponseBody
String hello(){
return "hello world!";
}
2.在命令行运行该文件
命令:spring run app.groovy
3.服务启动后通过浏览器进行访问
地址:http://localhost:8080/hello