Class NativeImageMetadata
NativeImageMetadataProvider on the classpath.
One place asks the question, so every consumer gets the same answer: the Spring Boot hints registrar, the Quarkus build step, and the generator that embeds GraalVM metadata into the shipped jars. Before this existed the same hand-written list was copied into three integration modules and no extension module could contribute at all — a shape where the Quarkus and Spring answers could drift apart, and where a plain servlet deployment got nothing.
Discovery is a union: providers cannot remove each other's entries, only add. Registering a type that is never used costs image size; failing to register one that is used costs a runtime failure, usually a silent one. The asymmetry is the reason this errs toward inclusion.
-
Method Summary
Modifier and TypeMethodDescriptionstatic NativeImageMetadatacollect()Collect using the class loader that loaded this class.static NativeImageMetadatacollect(ClassLoader classLoader) Collect from every available provider visible toclassLoader.Names of the providers that contributed, for logging and generated-file provenance.Type names to register for reflection, de-duplicated, in provider order.Resource patterns to include in the image, de-duplicated, in provider order.typeReachedCondition(String type) ThetypeReachedcondition for a reflective type, when its provider declared one (seeNativeImageMetadataProvider.typeReachedCondition()).
-
Method Details
-
collect
Collect using the class loader that loaded this class. -
collect
Collect from every available provider visible toclassLoader.A provider that throws while loading is skipped with a warning rather than aborting: it is one module's metadata, and losing it should not stop an image build or a startup that would otherwise succeed. The skip is logged at WARN because the consequence — some types quietly unregistered — is exactly the kind of thing that must not pass unnoticed.
- Parameters:
classLoader- loader to search, may benullfor the system loader- Returns:
- the merged metadata, never
null
-
reflectiveTypes
Type names to register for reflection, de-duplicated, in provider order. -
resourcePatterns
Resource patterns to include in the image, de-duplicated, in provider order. -
providerNames
Names of the providers that contributed, for logging and generated-file provenance. -
typeReachedCondition
ThetypeReachedcondition for a reflective type, when its provider declared one (seeNativeImageMetadataProvider.typeReachedCondition()).- Parameters:
type- a name fromreflectiveTypes()- Returns:
- the gating type name, or
nullwhen unconditional
-