This commit is contained in:
Stephane Nicoll
2022-06-09 15:12:38 +02:00
parent 363722893b
commit 1e5f4f8b44

View File

@@ -19,14 +19,16 @@ package org.springframework.aot.hint;
import org.springframework.lang.Nullable;
/**
* Contract for registering {@link RuntimeHints} in a static fashion.
* <p>Implementations will contribute hints without any knowledge of the application context
* and can only use the given {@link ClassLoader} to conditionally contribute hints.
* <p>{@code RuntimeHintsRegistrar} can be declared as {@code spring/aot.factories} entries;
* the registrar will be processed as soon as its declaration is found in the classpath.
* A standard no-arg constructor is required for implementations.
* Contract for registering {@link RuntimeHints} based on the {@link ClassLoader}
* of the deployment unit. Implementations should, if possible, use the specified
* {@link ClassLoader} to determine if hints have to be contributed.
*
* <p>Implementations of this interface can be registered statically in
* {@code META-INF/spring/aot.factories} by using the FQN of this interface as
* the key. A standard no-arg constructor is required for implementations.
*
* @author Brian Clozel
* @author Stephane Nicoll
* @since 6.0
*/
@FunctionalInterface
@@ -34,7 +36,7 @@ public interface RuntimeHintsRegistrar {
/**
* Contribute hints to the given {@link RuntimeHints} instance.
* @param hints the hints contributed so far for the application
* @param hints the hints contributed so far for the deployment unit
* @param classLoader the classloader, or {@code null} if even the system ClassLoader isn't accessible
*/
void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader);