@Autowiredアノテーションをつけることができる箇所(3つ)
・フィールド変数
・コンストラクタの引数
・setterの引数
※引用
【後悔しないための入門書】Spring解体新書: Spring Boot2で実際に作って学べる!
位置No.983
messages.propertiesを使えるようにする
・application.propertiesへの追記
spring.messages.basename=messages
spring.messages.encoding=UTF-8
・messages.propertiesファイルの作成
(作成場所)src/main/resources直下
(例)typeMismatch.int=数値で入力してください。
AOPのexecution
・指定方法
“execution(<戻り値> <パッケージ名>.<コントローラ名>.メソッド名(<引数>))”
(注)<戻り値> と <パッケージ名> の間は、半角スペースを入れること。
・例
"execution(* com.example.demo.login.controller.LoginController.getLogin())"
th:field と th:value の違い
Springでよく使用するテンプレートエンジンのThymeleafの機能についてです。
INPUT TYPE=TEXTの場合
<th:field>
id, name, value属性が付与される。
1 2 3 |
<input type="text" <span class="ymarker">th:field</span>="*{userId}" /> |
↓
1 2 3 |
<input type="text" <span class="ymarker">id</span>="userId" <span class="ymarker">name</span>="userId" <span class="ymarker">value</span>="1"> |
<th:value>
value属性のみ付与される。
1 2 3 |
<input type="text" <span class="ymarker">th:value</span>="*{userId}" /> |
↓
1 2 3 |
<input type="text" <span class="ymarker">value</span>="1"> |
INPUT TYPE=RADIOの場合
こちらを参照
↓
inputタグ・type=”radio” における提供機能