2929 * <p>
3030 * Provides lazy access to singletons that may be expensive to create, or need to be
3131 * shared before the {@link ApplicationContext} is available.
32+ * <p>
33+ * Instances are registered by type. The contact may return {@code null} values when a
34+ * type has been registered but no value is actually supplied.
3235 *
3336 * @author Phillip Webb
3437 * @since 4.0.0
38+ * @since 2.4.0
39+ * @see BootstrapRegistry
3540 */
3641public interface BootstrapContext {
3742
@@ -40,7 +45,7 @@ public interface BootstrapContext {
4045 * will be created if it hasn't been accessed previously.
4146 * @param <T> the instance type
4247 * @param type the instance type
43- * @return the instance managed by the context
48+ * @return the instance managed by the context, which may be {@code null}
4449 * @throws IllegalStateException if the type has not been registered
4550 */
4651 <T > @ Nullable T get (Class <T > type ) throws IllegalStateException ;
@@ -51,7 +56,7 @@ public interface BootstrapContext {
5156 * @param <T> the instance type
5257 * @param type the instance type
5358 * @param other the instance to use if the type has not been registered
54- * @return the instance
59+ * @return the instance, which may be {@code null}
5560 */
5661 <T > @ Nullable T getOrElse (Class <T > type , @ Nullable T other );
5762
@@ -61,7 +66,7 @@ public interface BootstrapContext {
6166 * @param <T> the instance type
6267 * @param type the instance type
6368 * @param other a supplier for the instance to use if the type has not been registered
64- * @return the instance
69+ * @return the instance, which may be {@code null}
6570 */
6671 <T > @ Nullable T getOrElseSupply (Class <T > type , Supplier <@ Nullable T > other );
6772
@@ -72,7 +77,7 @@ public interface BootstrapContext {
7277 * @param <X> the exception to throw if the type is not registered
7378 * @param type the instance type
7479 * @param exceptionSupplier the supplier which will return the exception to be thrown
75- * @return the instance managed by the context
80+ * @return the instance managed by the context, which may be {@code null}
7681 * @throws X if the type has not been registered
7782 * @throws IllegalStateException if the type has not been registered
7883 */
0 commit comments