When I add @RefreshScope on a bean as well as @ConditionOnMissingBean(A.class), though A.class and bean a is in spring container, the bean always loaded in spring ,the @ConditionOnMissingBean likes unaviable . But I remove @RefreshScope, it works normal and the bean is not loader in spring.

this is my code springboot version is 3.3.4,cloud version is 4.1.2

` @SpringBootApplication public class ReactiveApplication {

public static void main(String[] args) {
    SpringApplication.run(ReactiveApplication.class);
}

@ConditionalOnMissingBean(ReactiveApplication.class)
@RefreshScope
@Component
public static  class TestConfig {
    static {
        System.out.println("TestConfig class loaded");
    }
}

} ` ReactiveApplication is main springboot class, so it is always loaded in spring, so normally @ConditionalOnMissingBean is uneffective and TestConfig is not loaded. But actually TestConfig was loaded and print “TestConfig class loaded”. However, When remove "@RefreshScope", it was normal and not print "TestConfig class loaded".

I just think the all anonation like @Conditionxxx is unavaiable with RefreshScope, but when I use @ConditonOnProperty and @ConditionalOnMissingClass, it works normally. Why?

Comment From: sdeleuze

This bug tracker is only for bug or enhancement requests related to Spring Framework. Your question is about @RefreshScope which is part of Spring Cloud Config, combined with conditional Spring Boot annotations.

You should probably ask it on https://stackoverflow.com unless you have a clear indication that's a bug, and if it is, you should raise it in the relevant project with a reproducer.

Comment From: kdxxxx

Thanks.It is my problem,I will add a issue for spring cloud config,Not spring