JDKをインストール
$ brew cask install java
SDKMANをインストール
$ curl -s "https://get.sdkman.io" | bash
Spring Bootをインストール
$ sdk install springboot 1.4.2.RELEASE
$ spring version
Spring CLI v1.4.2.RELEASE
Hello World!
以下のようなコードを書きます。
hello.groovy
@RestController
class WebApplication {
@RequestMapping("/")
String home() {
"Hello World!"
}
}
早速実行してみます!
$ spring run hello.groovy
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.3.0.RELEASE)
起動できましたね!
http://localhost:8080
を開いてみましょう。5分でできましたか?(笑)
http://docs.spring.io/spring-boot/docs/current/reference/html/cli-using-the-cli.html
https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-cli.html#cli-run