springboot学习:2.测试运行

选择一目录,使用文本编辑器创建一个名为“app.groovy”的groovy文件,内容如下:

@RestController
class ThisWillActuallyRun {
	@RequestMapping("/")
	String home() {
  	"Hello World!"
 	}
 }

在这里插入图片描述
然后运行spring run app.groovy命令,第一次运行会比较慢:
在这里插入图片描述
springboot运行完毕会,界面会暂停在如下位置:
在这里插入图片描述
因为springboot会内嵌tomcat服务器,此时你可以访问http://localhost:8080/地址。出现“Hello World!”表示测试运行成功。
在这里插入图片描述
而CLI界面则会结束运行。
在这里插入图片描述

发布了13 篇原创文章 · 获赞 0 · 访问量 225

猜你喜欢

转载自blog.csdn.net/weixin_43859070/article/details/103885154