spring boot(ことはじめ)


## はじめに
普段、Javaを使うことはないのですが、
企業によっては、一部、Javaで動いているシステムとかもあるっぽかったりするので、
勉強がてら、構築してみました。
今回は、Spring boot CLIに

下記を参考にしました。
https://projects.spring.io/spring-boot/
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#getting-started-installing-the-cli

# 環境
Mac OS Sierra

## install
`$ curl http://repo.spring.io/release/org/springframework/boot/spring-boot-cli/1.5.4.RELEASE/spring-boot-cli-1.5.4.RELEASE-bin.tar.gz`

## SDKのinstall
`$ curl -s "https://get.sdkman.io" | bash`

## springboot install
```
$ sdk install springboot
$ spring --version
Spring CLI v1.5.4.RELEASE
```

## setting
```
$ sdk install springboot dev ~/Downloads/spring-1.5.4.RELEASE/
$ sdk default springboot dev
$ spring --version
Spring CLI v1.5.4.RELEASE
```

``` 
$ sdk ls springboot

================================================================================
Available Springboot Versions
================================================================================
 > + dev                  1.4.0.M3             1.3.0.M1             1.1.4.RELEASE
   * 1.5.4.RELEASE        1.3.8.RELEASE        1.2.8.RELEASE        1.1.3.RELEASE
     1.5.3.RELEASE        1.3.7.RELEASE        1.2.7.RELEASE        1.1.2.RELEASE
     1.5.2.RELEASE        1.3.6.RELEASE        1.2.6.RELEASE        1.1.12.RELEASE
     1.5.1.RELEASE        1.3.5.RELEASE        1.2.5.RELEASE        1.1.11.RELEASE
     1.5.0.RC1            1.3.4.RELEASE        1.2.4.RELEASE        1.1.10.RELEASE
     1.4.7.RELEASE        1.3.3.RELEASE        1.2.3.RELEASE        1.1.1.RELEASE
     1.4.6.RELEASE        1.3.2.RELEASE        1.2.2.RELEASE        1.1.0.RELEASE
     1.4.5.RELEASE        1.3.1.RELEASE        1.2.1.RELEASE        1.0.2.RELEASE
     1.4.4.RELEASE        1.3.0.RELEASE        1.2.0.RELEASE        1.0.1.RELEASE
     1.4.3.RELEASE        1.3.0.RC1            1.1.9.RELEASE        1.0.0.RELEASE
     1.4.2.RELEASE        1.3.0.M5             1.1.8.RELEASE
     1.4.1.RELEASE        1.3.0.M4             1.1.7.RELEASE
     1.4.0.RELEASE        1.3.0.M3             1.1.6.RELEASE
     1.4.0.RC1            1.3.0.M2             1.1.5.RELEASE

================================================================================
+ - local version
* - installed
> - currently in use
================================================================================
```

## brew install
```  
$ brew tap pivotal/tap
$ brew install springboot
```

``` 
$ chmod 777  ~/Downloads/spring-1.5.4.RELEASE/shell-completion/bash/spring
$  ~/Downloads/spring-1.5.4.RELEASE/shell-completion/bash/spring
```

## vim app.groovy
```
@RestController
class ThisWillActuallyRun {

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

}
```

## 
```
spring run app.groovy
Resolving dependencies..............

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.5.4.RELEASE)

```

## localhost:8080にアクセス
<img width="632" alt="スクリーンショット 2017-07-24 15.54.08.png" src="https://qiita-image-store.s3.amazonaws.com/0/95172/419dd398-ae3a-fa05-7028-1980177bdd01.png">