LoginSignup
3
2

More than 3 years have passed since last update.

SDKMANを使って5分でできるSpringBootのHello World!

Last updated at Posted at 2016-11-27

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

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2