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