LoginSignup
0
0

More than 3 years have passed since last update.

【Spring Boot】 Using MySQL Database & BootStrap

Last updated at Posted at 2021-02-14


  今回は、Spring initializrからプロジェクトを作成しました。

学べたこと

:star: Spring initializrからプロジェクトを作成する
:star: MySQLとの接続
:star: クエリ情報の受け渡し
:star: BootStrapの導入
:star: Thymeleafの記述方法

参考動画

IMAGE ALT TEXT HERE
YouTube:https://youtu.be/foARzSz_1WU

Software programs

Spring Tool Suite 4
Bootstrap
MySQL Database server

完成:gift:

2021-02-15_02h26_41.gif

まとめ

今回苦労した点は、EditとDeleteボタンのクエリ情報の受け渡しの記述でした:pencil2:
下記の様に記述しました:star:

index.html
<!-- Add new ボタン-->
<a th:href="@{'/new/'}">Add new</a>

<!-- Edit & Delete ボタン-->
<td><a th:href="@{/edit/{id}(id=${student.id})}" class="btn btn-primary">Edit </a></td>
<td><a th:href="@{/delete/{id}(id=${student.id})}" class="btn btn-danger">Delete</a></td>

今回登場したアノテーション
:hatching_chick:Entityクラスに登場
  @Entity
  @table
  @Id
  @GeneratedValue
  @Column

:ear_of_rice:Repositoryクラスに登場
  @Repository

:beer:Serviceクラスに登場
  @Service
  @Autowired

:video_game:Controllerクラスに登場
  @Controller
  @GetMapping
  @RequestMapping
  @PathVariable
  @ModelAttribute

最後に

次は、Spring Securityのプロジェクトを作成します。

次のプロジェクト:【Spring Boot】 Registration and Login with MySQL Database, Bootstrap and HTML5, Spring Security

0
0
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
0
0