diff --git a/core/spring-boot/src/main/java/org/springframework/boot/bootstrap/BootstrapContext.java b/core/spring-boot/src/main/java/org/springframework/boot/bootstrap/BootstrapContext.java index 6a5746ef742..b2970b84bcd 100644 --- a/core/spring-boot/src/main/java/org/springframework/boot/bootstrap/BootstrapContext.java +++ b/core/spring-boot/src/main/java/org/springframework/boot/bootstrap/BootstrapContext.java @@ -29,9 +29,14 @@ import org.springframework.core.env.Environment; *

* Provides lazy access to singletons that may be expensive to create, or need to be * shared before the {@link ApplicationContext} is available. + *

+ * Instances are registered by type. The contact may return {@code null} values when a + * type has been registered but no value is actually supplied. * * @author Phillip Webb * @since 4.0.0 + * @since 2.4.0 + * @see BootstrapRegistry */ public interface BootstrapContext { @@ -40,7 +45,7 @@ public interface BootstrapContext { * will be created if it hasn't been accessed previously. * @param the instance type * @param type the instance type - * @return the instance managed by the context + * @return the instance managed by the context, which may be {@code null} * @throws IllegalStateException if the type has not been registered */ @Nullable T get(Class type) throws IllegalStateException; @@ -51,7 +56,7 @@ public interface BootstrapContext { * @param the instance type * @param type the instance type * @param other the instance to use if the type has not been registered - * @return the instance + * @return the instance, which may be {@code null} */ @Nullable T getOrElse(Class type, @Nullable T other); @@ -61,7 +66,7 @@ public interface BootstrapContext { * @param the instance type * @param type the instance type * @param other a supplier for the instance to use if the type has not been registered - * @return the instance + * @return the instance, which may be {@code null} */ @Nullable T getOrElseSupply(Class type, Supplier<@Nullable T> other); @@ -72,7 +77,7 @@ public interface BootstrapContext { * @param the exception to throw if the type is not registered * @param type the instance type * @param exceptionSupplier the supplier which will return the exception to be thrown - * @return the instance managed by the context + * @return the instance managed by the context, which may be {@code null} * @throws X if the type has not been registered * @throws IllegalStateException if the type has not been registered */