Skip to content

feat(native): RuntimeHintsRegistrar for GraalVM Native (planning §14)#10

Merged
jlc488 merged 1 commit into
mainfrom
feat/graalvm-hints
May 26, 2026
Merged

feat(native): RuntimeHintsRegistrar for GraalVM Native (planning §14)#10
jlc488 merged 1 commit into
mainfrom
feat/graalvm-hints

Conversation

@jlc488
Copy link
Copy Markdown
Contributor

@jlc488 jlc488 commented May 26, 2026

Summary

Adds the GraalVM Native hints registration that planning §14 calls out as a first-class requirement. Does not actually run nativeCompile — that's deferred to consumer apps' own pipelines (or a tag-only CI job later) because the build is heavy (10–20 min, 8GB+ memory) and routinely needs follow-up fix cycles per missing hint.

Stacked on all previously-merged PRs (#1-#9). Should be clean since CI now runs and everything else is on main.

What's wired

DevslabKitRuntimeHints (new) is loaded via @ImportRuntimeHints on TenantAutoConfiguration (always active when the kit is on the classpath).

Reflection — MemberCategory.values()

Hibernate needs constructor + method + field access:

  • Platform{UserAccount,Role,Permission,UserRole,RolePermission,Group,UserGroup,GroupRole,Menu,AuditLog}Entity

Reflection — constructors + methods

ApplicationListener callbacks reflect on accessors:

  • Login{Succeeded,Failed}Event, UserAccountCreatedEvent

Resources

  • db/migration/*.sql (Flyway V1–V6 bundled in each -core jar)
  • META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports (defensive)

What this does NOT do

  • Does not run ./gradlew nativeCompile — see header. sample-app already has the org.graalvm.buildtools.native plugin from PR chore: multi-module split with base platform contracts #1, so consumers / a follow-up cron can invoke it directly.
  • Does not enumerate every dynamic proxy or @ConfigurationProperties — Spring Boot's own AOT processor handles those automatically. We only register what's beyond its reach.

When nativeCompile produces a "missing reflection" error in the future

Add the offending class to DevslabKitRuntimeHints and ship a patch. That's the maintenance contract.

Verified

./gradlew :devslab-kit-sample-app:test  → BUILD SUCCESSFUL in 58s

Hints registration is a no-op at JVM-mode test time, but ApplicationContext still boots cleanly so the @ImportRuntimeHints wiring at least compiles + loads.

Adds DevslabKitRuntimeHints + wires it via @ImportRuntimeHints on
TenantAutoConfiguration (which is always active). Covers the
reflection / resource surface the kit will need under nativeCompile:

Reflection — full MemberCategory.values() so Hibernate can introspect
constructors, methods, and field access:
  - PlatformUserAccountEntity
  - PlatformRoleEntity / PermissionEntity / UserRoleEntity / RolePermissionEntity
  - PlatformGroupEntity / UserGroupEntity / GroupRoleEntity
  - PlatformMenuEntity
  - PlatformAuditLogEntity

Reflection — constructor + declared methods so Spring can invoke
ApplicationListener payloads:
  - LoginSucceededEvent / LoginFailedEvent / UserAccountCreatedEvent

Resources — pattern matches so the native image bundles them:
  - db/migration/*.sql               (Flyway V1-V6)
  - META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

What this does NOT do: actually run ./gradlew nativeCompile. That's
a 10-20 minute build with non-trivial memory needs and routinely
needs another fix-cycle (per-record hints, dynamic proxies). The
expectation is that consumer apps run nativeCompile in their own
pipeline (sample-app already has `org.graalvm.buildtools.native`
plugin from PR #1). When that produces a missing-hint failure, the
hint goes into this class.

Verified: ./gradlew :devslab-kit-sample-app:test  -> BUILD SUCCESSFUL in 58s
(hints registration doesn't run at JVM-mode test time, but the
ApplicationContext still boots cleanly so the @ImportRuntimeHints
wiring at least compiles + loads.)
@jlc488 jlc488 merged commit ee964e1 into main May 26, 2026
1 check passed
@jlc488 jlc488 deleted the feat/graalvm-hints branch May 30, 2026 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant