|
|
@ -16,7 +16,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
package org.springframework.boot.json;
|
|
|
|
package org.springframework.boot.json;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.stream.Stream;
|
|
|
|
import java.util.function.Consumer;
|
|
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.ser.std.ClassSerializer;
|
|
|
|
import com.fasterxml.jackson.databind.ser.std.ClassSerializer;
|
|
|
|
import com.fasterxml.jackson.databind.ser.std.FileSerializer;
|
|
|
|
import com.fasterxml.jackson.databind.ser.std.FileSerializer;
|
|
|
@ -29,6 +29,8 @@ import org.springframework.aot.hint.MemberCategory;
|
|
|
|
import org.springframework.aot.hint.ReflectionHints;
|
|
|
|
import org.springframework.aot.hint.ReflectionHints;
|
|
|
|
import org.springframework.aot.hint.RuntimeHints;
|
|
|
|
import org.springframework.aot.hint.RuntimeHints;
|
|
|
|
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
|
|
|
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
|
|
|
|
|
|
|
import org.springframework.aot.hint.TypeHint.Builder;
|
|
|
|
|
|
|
|
import org.springframework.aot.hint.TypeReference;
|
|
|
|
import org.springframework.util.ClassUtils;
|
|
|
|
import org.springframework.util.ClassUtils;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -38,6 +40,9 @@ import org.springframework.util.ClassUtils;
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
class JacksonRuntimeHints implements RuntimeHintsRegistrar {
|
|
|
|
class JacksonRuntimeHints implements RuntimeHintsRegistrar {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final Consumer<Builder> INVOKE_PUBLIC_CONSTRUCTORS = (hint) -> hint
|
|
|
|
|
|
|
|
.withMembers(MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS);
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
|
|
|
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
|
|
|
if (!ClassUtils.isPresent("com.fasterxml.jackson.databind.ser.BasicSerializerFactory", classLoader)) {
|
|
|
|
if (!ClassUtils.isPresent("com.fasterxml.jackson.databind.ser.BasicSerializerFactory", classLoader)) {
|
|
|
@ -47,10 +52,9 @@ class JacksonRuntimeHints implements RuntimeHintsRegistrar {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void registerSerializers(ReflectionHints hints) {
|
|
|
|
private void registerSerializers(ReflectionHints hints) {
|
|
|
|
Stream.of(AtomicBooleanSerializer.class, AtomicIntegerSerializer.class, AtomicLongSerializer.class,
|
|
|
|
hints.registerTypes(TypeReference.listOf(AtomicBooleanSerializer.class, AtomicIntegerSerializer.class,
|
|
|
|
FileSerializer.class, ClassSerializer.class, TokenBufferSerializer.class)
|
|
|
|
AtomicLongSerializer.class, FileSerializer.class, ClassSerializer.class, TokenBufferSerializer.class),
|
|
|
|
.forEach((type) -> hints.registerType(type,
|
|
|
|
INVOKE_PUBLIC_CONSTRUCTORS);
|
|
|
|
(hint) -> hint.withMembers(MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS)));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|