Skip to content

AOT Processing: RuntimeHintsRegistrar should be executed before ImportBeanDefinitionRegistrar #33995

@yuri-li

Description

@yuri-li

Issue Description

When using Spring Boot 3.x with GraalVM native compilation, I have two classes:

class RSocketFeignRuntimeHints : RuntimeHintsRegistrar {
    override fun registerHints(hints: RuntimeHints, classLoader: ClassLoader?) {
        // Register hints for RSocket Feign classes
    }
}
class RSocketClientsRegistrar : ImportBeanDefinitionRegistrar {
    override fun registerBeanDefinitions(metadata: AnnotationMetadata, registry: BeanDefinitionRegistry) {
        // Register RSocket client beans
    }
}

Expected Behavior

During native compilation:

  1. RuntimeHintsRegistrar should be executed first to register necessary hints
  2. Then ImportBeanDefinitionRegistrar should be executed to register beans

Actual Behavior

When running ./gradlew nativeCompile:

  1. ImportBeanDefinitionRegistrar is executed first
  2. The compilation fails because necessary hints are not registered
  3. RuntimeHintsRegistrar is not executed at all

Configuration

# src/main/resources/META-INF/spring/org.springframework.aot.hint.RuntimeHintsRegistrar
org.fu.common.feign.model.RSocketFeignRuntimeHints

# src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
org.fu.common.feign.RSocketClientsRegistrar

Question

How can we ensure RuntimeHintsRegistrar is executed before ImportBeanDefinitionRegistrar during native compilation?

Environment

  • Spring Boot: 3.3.5
  • GraalVM CE: 21.0.2
  • Gradle: 8.5

This seems to be a timing issue in Spring's AOT processing pipeline. Any suggestions on how to control the execution order would be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    for: stackoverflowA question that's better suited to stackoverflow.comstatus: invalidAn issue that we don't feel is valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions