Spring 05

・JpaRepository
databaseの操作というクラスです。

CrudRepositoryは、CRUD機能を提供しています。
PagingAndSortingRepositoryは、ページングおよびソートレコードを行うためのメソッドを提供しています。
JpaRepositoryは、永続コンテキストの更新やレコードの一括削除など、JPA関連のメソッドを提供しています。

@Autowired
userRepositoryというBeanを取得することです。
Springによって自動生成されます。
データを処理するために使用します。


・Thymeleaf属性
th:value  th:value="${msg}"
th:object th:object="${loginBean}"
th:field  th:field="*{username}"

@readOnly
boolean読み取り専用かどうかを指定する。デフォルトはfalse。


・Interable
もらった配列の文字
com.example.demo.entity.UserEntity@2d0716be

問題点:配列が表示されませんでした。
<th:each="obj : ${data}">
<th:text="${obj}">        <----使えます。
<th:text="${obj.userid}"> <----使えません。

解決方法:privateがpublicに変更します。
(UserEntity)

以前
@Column(name = "t_user")
private String userid;

現在
@Column(name = "t_user")
public String userid;