Migrate hint registration to shortcuts
Migrate code to make use of the `MemberCategory` and `FieldMode` shortcuts. See gh-29011
This commit is contained in:
@@ -16,12 +16,9 @@
|
||||
|
||||
package org.springframework.http.codec;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.springframework.aot.hint.MemberCategory;
|
||||
import org.springframework.aot.hint.RuntimeHints;
|
||||
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||
import org.springframework.aot.hint.TypeHint.Builder;
|
||||
import org.springframework.aot.hint.TypeReference;
|
||||
import org.springframework.http.codec.support.DefaultClientCodecConfigurer;
|
||||
import org.springframework.http.codec.support.DefaultServerCodecConfigurer;
|
||||
@@ -37,16 +34,14 @@ import org.springframework.lang.Nullable;
|
||||
*/
|
||||
class CodecConfigurerRuntimeHints implements RuntimeHintsRegistrar {
|
||||
|
||||
private static final Consumer<Builder> CODEC_HINT = type -> type
|
||||
.onReachableType(CodecConfigurerFactory.class)
|
||||
.withMembers(MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS);
|
||||
|
||||
@Override
|
||||
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
|
||||
hints.resources().registerPattern("org/springframework/http/codec/CodecConfigurer.properties");
|
||||
hints.reflection().registerTypes(TypeReference.listOf(
|
||||
DefaultClientCodecConfigurer.class, DefaultServerCodecConfigurer.class),
|
||||
CODEC_HINT);
|
||||
hints.resources().registerPattern(
|
||||
"org/springframework/http/codec/CodecConfigurer.properties");
|
||||
hints.reflection().registerTypes(
|
||||
TypeReference.listOf(DefaultClientCodecConfigurer.class, DefaultServerCodecConfigurer.class),
|
||||
typeHint -> typeHint.onReachableType(CodecConfigurerFactory.class)
|
||||
.withMembers(MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class RequestMappingReflectiveProcessor implements ReflectiveProcessor {
|
||||
}
|
||||
|
||||
protected void registerTypeHints(ReflectionHints hints, Class<?> type) {
|
||||
hints.registerType(type, hint -> {});
|
||||
hints.registerType(type);
|
||||
}
|
||||
|
||||
protected void registerMethodHints(ReflectionHints hints, Method method) {
|
||||
|
||||
Reference in New Issue
Block a user