Skip to content

[GR-60853] [Native Image] ImportBeanDefinitionRegistrar not load the bean #10277

Open
@tadlakha9

Description

@tadlakha9

Describe the Issue

We have a scenario where we are loading a bean using a custom annotation with the help of ImportBeanDefinitionRegistrar but bean is not loaded and we are getting below exception

image

Gradle bootRun task is working fine.

We have generated an executable(working fine), now while running the executable we are getting the issue, we are using graalvm 17. Facing the same issue with graalvm 21 and graalvm 23

Please find the reproducer.

practice.zip

Using the latest version of GraalVM can resolve many issues.

GraalVM Version

java version "17.0.13" 2024-10-15 LTS
Java(TM) SE Runtime Environment Oracle GraalVM 17.0.13+10.1 (build 17.0.13+10-LTS-jvmci-23.0-b49)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 17.0.13+10.1 (build 17.0.13+10-LTS-jvmci-23.0-b49, mixed mode, sharing)

Operating System and Version

Linux 4.18.0-372.105.1.el8_6.x86_64 #1 SMP x86_64 GNU/Linux

Build Command

gradle nativeRun

Expected Behavior

our expectation is that the bean to be loaded while using ImportBeanDefinitionRegistrar

Actual Behavior

executable is generated perfectly fine, issue only while running the executable.

Steps to Reproduce

  1. gradle nativeRun : this is the command we can use to reproduce the issue.

Additional Context

No response

Build Log Output and Error Messages


APPLICATION FAILED TO START


Description:

Parameter 0 of constructor in com.example.practice.service.CustomerService required a bean of type 'com.example.practice.client.CustomerClient' that could not be found.

Action:

Consider defining a bean of type 'com.example.practice.client.CustomerClient' in your configuration.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions