@InitBinder
Spring Boot アプリケーションをデバッグしているときに、 で注釈が付けられたメソッドが着信リクエストごとに呼び出されることに気付きました。
@InitBinder("categories")
public void bindFields(WebDataBinder binder) {
binder.registerCustomEditor(Set.class, new CustomPropertyEditor());
}
@InitBinder
メソッドでは、 a をバインダーに設定してPropertyEditor
います。なぜこれらのメソッドを何度も呼び出して同じものを設定する必要があるのか わかりません。Spring はリクエストごと
に新しいオブジェクトを作成しますか?WebDataBinder