Migrate hint registration to shortcuts
Migrate code to make use of the `MemberCategory` and `FieldMode` shortcuts. See gh-29011
This commit is contained in:
@@ -55,7 +55,7 @@ public class SimpleReflectiveProcessor implements ReflectiveProcessor {
|
||||
* @param type the class to process
|
||||
*/
|
||||
protected void registerTypeHint(ReflectionHints hints, Class<?> type) {
|
||||
hints.registerType(type, hint -> {});
|
||||
hints.registerType(type);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.springframework.aot.hint.support;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -26,7 +25,6 @@ import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.aot.hint.MemberCategory;
|
||||
import org.springframework.aot.hint.RuntimeHints;
|
||||
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||
import org.springframework.aot.hint.TypeHint;
|
||||
import org.springframework.core.io.support.SpringFactoriesLoader;
|
||||
import org.springframework.core.log.LogMessage;
|
||||
import org.springframework.lang.Nullable;
|
||||
@@ -45,9 +43,6 @@ class SpringFactoriesLoaderRuntimeHints implements RuntimeHintsRegistrar {
|
||||
private static final List<String> RESOURCE_LOCATIONS =
|
||||
List.of(SpringFactoriesLoader.FACTORIES_RESOURCE_LOCATION);
|
||||
|
||||
private static final Consumer<TypeHint.Builder> HINT = builder ->
|
||||
builder.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
|
||||
|
||||
private static final Log logger = LogFactory.getLog(SpringFactoriesLoaderRuntimeHints.class);
|
||||
|
||||
|
||||
@@ -78,7 +73,7 @@ class SpringFactoriesLoaderRuntimeHints implements RuntimeHintsRegistrar {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace(LogMessage.format("Processing factories for [%s]", factoryClassName));
|
||||
}
|
||||
hints.reflection().registerType(factoryClass, HINT);
|
||||
hints.reflection().registerType(factoryClass, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
|
||||
for (String implementationClassName : implementationClassNames) {
|
||||
Class<?> implementationType = resolveClassName(classLoader, implementationClassName);
|
||||
if (logger.isTraceEnabled()) {
|
||||
@@ -87,7 +82,7 @@ class SpringFactoriesLoaderRuntimeHints implements RuntimeHintsRegistrar {
|
||||
implementationClassName));
|
||||
}
|
||||
if (implementationType != null) {
|
||||
hints.reflection().registerType(implementationType, HINT);
|
||||
hints.reflection().registerType(implementationType, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user