Squashed commit of the following:

commit 0d624137c2557c6eeb87020749e4977b821c2b5c
Author: Adrien <adrien.cesaro@proton.me>
Date:   Thu Apr 9 11:55:22 2026 +0200

    backend native image setup
This commit is contained in:
Adrien
2026-04-09 12:05:02 +02:00
parent aee6a9dfba
commit d8bcdce879
17 changed files with 1285 additions and 6 deletions
@@ -0,0 +1,76 @@
package com.aiteacher.config;
import org.springframework.aot.hint.MemberCategory;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.aot.hint.TypeReference;
/**
* GraalVM native-image runtime hints for third-party libraries that use reflection
* or classpath resource scanning not covered by Spring Boot's AOT processor.
*
* Registered via @ImportRuntimeHints on AiTeacherApplication.
*/
public class NativeHintsConfig implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
// PDFBox — font and encoding resources loaded via classpath scanning at runtime
hints.resources().registerPattern("org/apache/pdfbox/resources/*");
hints.resources().registerPattern("org/apache/pdfbox/resources/afm/*");
hints.resources().registerPattern("org/apache/pdfbox/resources/cmap/*");
hints.resources().registerPattern("org/apache/pdfbox/resources/glyphlist/*");
hints.resources().registerPattern("org/apache/pdfbox/resources/icc/*");
hints.resources().registerPattern("org/apache/pdfbox/resources/ttf/*");
hints.resources().registerPattern("org/apache/pdfbox/resources/version.properties");
// PDFBox — font encoding classes instantiated via reflection
hints.reflection().registerType(
org.apache.pdfbox.pdmodel.font.encoding.GlyphList.class,
MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS,
MemberCategory.INVOKE_PUBLIC_METHODS
);
hints.reflection().registerType(
org.apache.pdfbox.pdmodel.font.encoding.WinAnsiEncoding.class,
MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS
);
hints.reflection().registerType(
org.apache.pdfbox.pdmodel.font.encoding.MacRomanEncoding.class,
MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS
);
hints.reflection().registerType(
org.apache.pdfbox.pdmodel.font.encoding.MacExpertEncoding.class,
MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS
);
hints.reflection().registerType(
org.apache.pdfbox.pdmodel.font.encoding.StandardEncoding.class,
MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS
);
// JPA / Hibernate — array types used in entity mappings
hints.reflection().registerType(java.util.UUID[].class, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS);
// JBoss Logging — message logger implementations generated by annotation processor.
// JBoss Logging uses reflection to look up the generated *_$logger class by name.
registerJBossLogger(hints, "org.hibernate.jpa.internal.JpaLogger_$logger");
registerJBossLogger(hints, "org.hibernate.internal.CoreMessageLogger_$logger");
registerJBossLogger(hints, "org.hibernate.internal.EntityManagerMessageLogger_$logger");
// AWS SDK v2 — HTTP client and SdkPojo serialization
hints.resources().registerPattern("software/amazon/awssdk/global/handlers/execution.interceptors");
hints.resources().registerPattern("software/amazon/awssdk/services/s3/execution.interceptors");
hints.resources().registerPattern("codegen-resources/s3/*");
hints.reflection().registerType(
software.amazon.awssdk.services.s3.S3Client.class,
MemberCategory.INVOKE_PUBLIC_METHODS
);
}
private void registerJBossLogger(RuntimeHints hints, String className) {
hints.reflection().registerType(
TypeReference.of(className),
MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS,
MemberCategory.INVOKE_PUBLIC_METHODS
);
}
}