10
11

More than 1 year has passed since last update.

【これさえ読めばなんとなく違いがわかる】SpringBootの@〇〇Mappingとは?

Posted at

今回比較する@〇〇Mapping

1.RequestMapping
2.PostMapping
3.GetMapping
4.DeleteMapping
5.PutMapping

使い分けるメリット

一目見てどんな処理をしているメソッドが判断できるため、可読性が上がる
例)Getであれば登録データの取得のメソッドetc...

詳細は以下をチェック!

各@〇〇Mappingの使い方

1.RequestMapping

サイト全体の入り口部分。
例)Qiitaにアクセスする

2.PostMapping

新しいデータを登録する役割を果たす。(INSERT処理
例)Qiitaにユーザー登録する/Qiitaに記事を投稿するetc...

3.GetMapping

登録されているデータを取得する役割を果たす。
例)Qiitaのトレンドから1件の記事を開くetc...

4.DeleteMapping

登録されている値を削除する役割を果たす。
例)Qiitaからユーザーを削除する/Qiitaへの投稿を削除するetc...

5.PutMapping

既存データの上書きをする役割を果たす。(UPDATE処理
例)Qiitaの記事を修正する/Qiitaのユーザーデータを修正するetc...

参考

https://dkssksk.com/springbootmapping/

10
11
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
10
11