在 Chromebook 上使用 Spring Boot
安装
sudo apt install zip
sudo apt install default-jdk
#
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk install springboot
#
确认版本
$ spring version
Spring CLI v2.6.2
服务器程序
@RestController
class ThisWillActuallyRun {
@RequestMapping("/")
String home() {
def str_out = "Good Morning!<br />\n" + "Hello World!<br />\n" \
+ "Hello World!(Groovy version : ${GroovySystem.version})<br />\n"
return str_out
}
}
服务器的启动
spring run app.groovy
请使用客户端访问 http://localhost:8080/
$ http localhost:8080
HTTP/1.1 200
Connection: keep-alive
Content-Length: 83
Content-Type: text/plain;charset=UTF-8
Date: Wed, 22 Dec 2021 03:44:11 GMT
Keep-Alive: timeout=60
Good Morning!<br />
Hello World!<br />
Hello World!(Groovy version : 3.0.9)<br />