Controller

@Transactional

トランザクション制御

メソッドの上に記述
メソッド内のDBを利用する一連の処理を一括して実行する
@Transactional(readOnly=false) とすることでデータ更新を許可する

@ModelAttribute

@ModelAttributeの利用

エンティティクラスのインスタンスを自動的に用意し、ControllerとView間でのエンティティの受け渡しを行える。

Controller側

View側

Controller 基本

@RestController の基本

@Controller

@PathVariable

Model.addAttribute

@Controller 2

@RequestParam

RequestMethod

ModelAndView.addObject