Skip to content

Qualifiers registered programmatically are not supported by AOT #30410

Closed
@DanielThomas

Description

@DanielThomas

Qualifiers aren't captured by AOT in the generated BeanDefinitions classes, leading to failures when running under AOT:

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of constructor in com.example.demo.DemoApplication$RequiresGrpcClient required a bean of type 'com.example.demo.DemoApplication$GrpClient' that could not be found.

The injection point has the following annotations:
	- @com.example.demo.GrpcSpringClient("myclient")

The following candidates were found but could not be injected:
	- User-defined bean


Action:

Consider revisiting the entries above or defining a bean of type 'com.example.demo.DemoApplication$GrpClient' in your configuration.

In our specific case, they're custom qualifier annotations and definitions registered by a registry post-processor. It appears for simple annotated Qualifier beans, the framework is able to fallback and infer the qualifier.

Example project:

https://github.com/DanielThomas/spring-aot-issues/tree/dannyt/qualifier-missing

Run and note the failure:

./gradlew bootJar && java -Dspring.aot.enabled=true -jar build/libs/demo-0.0.1-SNAPSHOT.jar

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)theme: aotAn issue related to Ahead-of-time processingtype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions