diff --git a/II. Getting started/10.2.6. Quick start Spring CLI example.md b/II. Getting started/10.2.6. Quick start Spring CLI example.md index e69de29..32fafd7 100644 --- a/II. Getting started/10.2.6. Quick start Spring CLI example.md +++ b/II. Getting started/10.2.6. Quick start Spring CLI example.md @@ -0,0 +1,24 @@ +### 10.2.6. Spring CLI示例快速入门 + +下面是一个相当简单的web应用,你可以用它测试你的安装是否成功。创建一个名叫`app.groovy`的文件: +```groovy +@RestController +class ThisWillActuallyRun { + + @RequestMapping("/") + String home() { + "Hello World!" + } + +} +``` +然后简单地从一个shell中运行它: +```shell +$ spring run app.groovy +``` +**注**:当你首次运行该应用时将会花费一点时间,因为需要下载依赖。后续运行将会快很多。 + +在你最喜欢的浏览器中打开[localhost:8080](localhost:8080),然后你应该看到以下输出: +```java +Hello World! +```