spring-projects / spring-projects/spring-framework

Add support for @Nonbinding in @jakarta.inject.Qualifier annotations

Open
#26,302 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: core type: enhancement
Dominant language
Java
Stars
60.2k
Forks
38.8k
Avg merge
5d 2h
Merged PRs (30d)
27

Description

Affects: 5.3.2

In our project we reuse Java annotations across Framework boundaries (Spring/CDI/Micronaut). It turns our that Spring does not fully support the semantics of javax.inject.Qualifier annotations. Specifically, Spring Framework should support the marking of annotation fields with the @Nonbinding annotation. This would be especially useful when using @Bean methods together with org.springframework.beans.factory.InjectionPoint.

I have created a demo application to show the current behavior and desired behavior:

https://github.com/ghillert/spring-injectionpoint-demo

Please see especially:

https://github.com/ghillert/spring-injectionpoint-demo/blob/main/src/main/java/com/hillert/injectionpoint/config/AppConfig.java

It looks like @jhoeller aknowledged the issue in 2016:

https://gist.github.com/moelholm/4317e93f18b02e9582afefc152debb44

For reference:

Java EE JavaDoc - Annotation Type Nonbinding
https://javaee.github.io/javaee-spec/javadocs/javax/enterprise/util/Nonbinding.html

Advanced Using @Nonbinding to combine a configuration annotation and a qualifier annotation into one annotation
https://dzone.com/articles/cdi-di-p2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked demo's src/main/java/com/hillert/injectionpoint/config/AppConfig.java and compare its behavior with the Jakarta EE Nonbinding documentation. Trace how Spring handles qualifier annotation fields when resolving InjectionPoint-based beans. Done means the demo's desired behavior works for qualifier fields marked with @Nonbinding, with appropriate framework coverage added.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend, backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.