spring-projects / spring-projects/spring-framework

consider return a distincted value of MultiValueMap for AnnotatedTypeMetadata.getAllAnnotationAttributes

Open
#35,011 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: core status: waiting-for-triage
Dominant language
Java
Stars
60.2k
Forks
38.8k
Avg merge
5d 2h
Merged PRs (30d)
27

Description

Here is a simple code sample:

@Configuration(proxyBeanMethods = false)
public class FooAutoConfiguration {

    @ConditionalOnBean(FooProperties.class)
    @ConditionalOnMissingBean
    @Bean
    public FooService fooService(FooProperties fooProperties) {
        return new FooService();
    }

}

pom.xml

...
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.5.0</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
...
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
    </dependencies>

While evaluator conditional of FooService, It will be evaluated twice for OnBeanCondition because the AnnotatedTypeMetadata.getAllAnnotationAttributes returned value contains same className array org.springframework.boot.autoconfigure.condition.OnBeanCondition.

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 by tracing AnnotatedTypeMetadata.getAllAnnotationAttributes and the OnBeanCondition evaluation path described in the sample. Confirm where the repeated org.springframework.boot.autoconfigure.condition.OnBeanCondition value is produced, then add a regression test showing the intended distinct result and that the condition is evaluated only once.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
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.