public interface BootstrapRegistryApplicationContext が準備されるまでの起動時および Environment 後処理中に使用可能な単純なオブジェクトレジストリ。 作成に費用がかかる可能性があるインスタンス、または ApplicationContext が使用可能になる前に共有する必要があるインスタンスを登録するために使用できます。
レジストリは ClassSE をキーとして使用します。つまり、特定の型のインスタンスを 1 つだけ保存できます。
addCloseListener(ApplicationListener) メソッドを使用して、BootstrapContext が閉じられ、ApplicationContext が完全に準備されたときにアクションを実行できるリスナーを追加できます。例: インスタンスは、アプリケーションが使用できるように、自身を通常の Spring Bean として登録することを選択できます。
BootstrapContext, ConfigurableBootstrapContext| 修飾子と型 | インターフェースと説明 |
|---|---|
static interface | BootstrapRegistry.InstanceSupplier<T> サプライヤーは、必要に応じて実際のインスタンスを提供するために使用されていました。 |
static class | BootstrapRegistry.Scope インスタンスのスコープ。 |
| 修飾子と型 | メソッドと説明 |
|---|---|
void | addCloseListener(ApplicationListener<BootstrapContextClosedEvent> listener)BootstrapContext が閉じられ、ApplicationContext が準備されたときに、BootstrapContextClosedEvent で呼び出される ApplicationListener を追加します。 |
<T> BootstrapRegistry.InstanceSupplier<T> | getRegisteredInstanceSupplier(ClassSE<T> type) 指定された型の既存の BootstrapRegistry.InstanceSupplier を返します。 |
<T> boolean | isRegistered(ClassSE<T> type) 指定された型の登録が存在する場合に戻ります。 |
<T> void | register(ClassSE<T> type, BootstrapRegistry.InstanceSupplier<T> instanceSupplier) 特定の型をレジストリに登録します。 |
<T> void | registerIfAbsent(ClassSE<T> type, BootstrapRegistry.InstanceSupplier<T> instanceSupplier) 特定の型がまだ存在しない場合は、レジストリに登録します。 |
<T> void register(ClassSE<T> type, BootstrapRegistry.InstanceSupplier<T> instanceSupplier)
singleton として取得されていない場合は、置き換えられます。T - インスタンス型 type - インスタンス型 instanceSupplier - インスタンスサプライヤー <T> void registerIfAbsent(ClassSE<T> type, BootstrapRegistry.InstanceSupplier<T> instanceSupplier)
T - インスタンス型 type - インスタンス型 instanceSupplier - インスタンスサプライヤー <T> boolean isRegistered(ClassSE<T> type)
T - インスタンス型 type - インスタンス型 true <T> BootstrapRegistry.InstanceSupplier<T> getRegisteredInstanceSupplier(ClassSE<T> type)
BootstrapRegistry.InstanceSupplier を返します。T - インスタンス型 type - インスタンス型 BootstrapRegistry.InstanceSupplier または nullvoid addCloseListener(ApplicationListener<BootstrapContextClosedEvent> listener)
BootstrapContext が閉じられ、ApplicationContext が準備されたときに、BootstrapContextClosedEvent で呼び出される ApplicationListener を追加します。listener - 追加するリスナー