fix deserialization error in native image
This commit is contained in:
@@ -5,6 +5,8 @@ import org.springframework.aot.hint.RuntimeHints;
|
|||||||
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||||
import org.springframework.aot.hint.TypeReference;
|
import org.springframework.aot.hint.TypeReference;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GraalVM native-image runtime hints for third-party libraries that use reflection
|
* GraalVM native-image runtime hints for third-party libraries that use reflection
|
||||||
* or classpath resource scanning not covered by Spring Boot's AOT processor.
|
* or classpath resource scanning not covered by Spring Boot's AOT processor.
|
||||||
@@ -64,6 +66,20 @@ public class NativeHintsConfig implements RuntimeHintsRegistrar {
|
|||||||
software.amazon.awssdk.services.s3.S3Client.class,
|
software.amazon.awssdk.services.s3.S3Client.class,
|
||||||
MemberCategory.INVOKE_PUBLIC_METHODS
|
MemberCategory.INVOKE_PUBLIC_METHODS
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Jackson deserialization of records persisted as JSON in DB columns.
|
||||||
|
// These are reached only via ObjectMapper.readValue in services, so Spring's
|
||||||
|
// BindingReflectionHintsRegistrar does not auto-discover all accessors.
|
||||||
|
for (Class<?> type : List.of(
|
||||||
|
com.aiteacher.topic.TopicSummaryResponse.class,
|
||||||
|
com.aiteacher.topic.TopicSummaryResponse.SourceReference.class,
|
||||||
|
com.aiteacher.concept.ConceptReportResponse.class,
|
||||||
|
com.aiteacher.concept.ConceptReportResponse.FacetSection.class
|
||||||
|
)) {
|
||||||
|
hints.reflection().registerType(type,
|
||||||
|
MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
|
||||||
|
MemberCategory.INVOKE_DECLARED_METHODS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerJBossLogger(RuntimeHints hints, String className) {
|
private void registerJBossLogger(RuntimeHints hints, String className) {
|
||||||
|
|||||||
Reference in New Issue
Block a user