1. 程式人生 > >Spring boot 官網學習筆記 - Spring Boot CLI 入門案例

Spring boot 官網學習筆記 - Spring Boot CLI 入門案例

  1. 安裝CLI
    1. https://repo.spring.io/release/org/springframework/boot/spring-boot-cli/2.1.1.RELEASE/spring-boot-cli-2.1.1.RELEASE-bin.zip
    2. 解壓後即可使用,免安裝。解壓位置 F:\tool\java\spring-boot-cli-2.1.1.RELEASE-bin\spring-2.1.1.RELEASE
    3. 設定環境變數 PATH+=F:\tool\java\spring-boot-cli-2.1.1.RELEASE-bin\spring-2.1.1.RELEASE\bin;
  2. 編制啟動指令碼
    1. F:\spring-boot-projects\test2\app.groovy
    2. @RestController
      class ThisWillActuallyRun {
          @RequestMapping("/")
          String home(){
              "Hello World!"
          }
      }

       

  3. 執行
    1. spring run app.groovy
  4. 效果