Skip to content

Native Image Test - #179

Open
crazyrokr wants to merge 3 commits into
feature/172-implement-native-buildfrom
feature/native-image-without-reachability-metadata
Open

Native Image Test#179
crazyrokr wants to merge 3 commits into
feature/172-implement-native-buildfrom
feature/native-image-without-reachability-metadata

Conversation

@crazyrokr

@crazyrokr crazyrokr commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

Removes the javaagent-generated reachability-metadata.json from the GraalVM native build and replaces its coverage with declarative Spring AOT hints, library-supplied metadata, build flags, and a reflection-free enum lookup — so the native image ships with no project-maintained reachability-metadata.json and no RuntimeHintsRegistrar. Also adds an automated test that boots the native binary and runs the existing MQTT integration specs against it.

Changes

  • Declarative hints for rlib array types. rlib's Array/ArrayFactory collections create typed arrays via Array.newInstance, so each component's array class must still be registered. NativeReflectionHintsConfig (a @Configuration imported by MqttBrokerApplication) declares these via @RegisterReflectionForBinding — an AOT-processed annotation, not a JSON file or RuntimeHintsRegistrar. (ExpirableSession/NotExpirableSession were made public so their array classes are referenceable.)
  • Third-party + JCE coverage via standard mechanisms. Enabled the GraalVM Reachability Metadata Repository (metadataRepository { enabled = true }) for libraries that don't ship their own metadata (Jackson, Logback, PostgreSQL-JDBC, SnakeYAML; Flyway 11.19.0 via the repo's latest-config fallback), and --enable-all-security-services for the JCE/TLS providers that were the 51 com.sun.crypto.provider entries. The GraalVM vendor match was broadened from GraalVM Community to GraalVM (matches CE and Oracle).
  • Automated native verification. NativeImageVerificationTest launches the compiled native binary, waits for the Started external MQTT network marker, and re-runs the application's integration specs against it via JUnit Platform TestKit (EmbeddedSpecRunner). Wired as the nativeImageTest task, with copyNativeImageTestResources staging test config/credentials/ACL next to the binary. Supporting changes: application exposes its test fixtures (testFixturesImplementation) and junit-platform-testkit was added.

Notes

  • --enable-all-security-services is deprecated by GraalVM but functional; a follow-up can migrate to its successor.
  • Flyway 11.19.0 relies on the metadata repository's latest-config fallback; if a future migration hits untested Flyway behavior, pin it via metadataRepository { moduleToConfigVersion = ['org.flywaydb:flyway-core': '11.14.1'] }.

@crazyrokr
crazyrokr force-pushed the feature/native-image-without-reachability-metadata branch from 08729d9 to feefd3e Compare June 22, 2026 00:13
@crazyrokr
crazyrokr force-pushed the feature/native-image-without-reachability-metadata branch from 0bd6a9e to e024e83 Compare June 22, 2026 00:46
@crazyrokr
crazyrokr requested a review from JavaSaBr June 22, 2026 00:46
@crazyrokr
crazyrokr marked this pull request as ready for review June 22, 2026 00:46
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