Spring Boot プログラミング入門

Chapter1 Spring開発のセットアップ

手順どおり確認

サーバー起動して確認した

http://localhost:8080/SampleWebApp/

 

Chapter2 Groovyによる超簡単アプリケーション開発

http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#getting-started-installing-the-cli

 

app.groovy

コマンドプロンプトで実行

spring run app.groovy

 

 Thymeleaf

テンプレートライブラリー

 

 

Chapter3 JavaによるSpring Boot開発の基本

JDKインストール

qiita.com

Mavenを用意

コマンドプロンプトから

mvn archetype:generate

mvn spring-boot:run

 

3.2 RestControllerを利用する

 

package com.tuyano.springboot;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;

@RestController
public class HelloController {

@RequestMapping("/{num}")
public String index(@PathVariable int num) {
int res = 0;
for (int i = 1; i <= num; i++)
res += i;
return "total: " + res;
}

}

 

Chapter4 テンプレートエンジンを使いこなす

4.1

th:text

th:utext エスケープしない

4.2構文・インライン・レイアウト

条件式、三項演算子

th:if

th:if/th:unless

th:switch

th:each

プリプロセッシグ __${テキスト}__

 

Chapter5 モデルとデータベース

ーーーーーーーーーーーーーーーーー

JPAJava Persistence API)永続化

HSQLDB

JTAトランザクション処理)

Spring ORM

Spring Aspects/Spring AOP

ーーーーーーーーーーーーーーーーーーーーー

Spring Boot Starter Data JPA