You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I add @RefreshScope on a bean (such as bean ‘myBean’) as well as @ConditionOnMissingBean(A.class), though A.class and bean a is in spring container, the bean 'myBean' always loaded in spring ,the @ConditionOnMissingBean likes unaviable . But I remove @RefreshScope, it works normal and the bean 'myBean' is not loader in spring.
this is my code
springboot version is 3.3.4,cloud-config version is 4.1.2
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?
The text was updated successfully, but these errors were encountered:
When I add @RefreshScope on a bean (such as bean ‘myBean’) as well as @ConditionOnMissingBean(A.class), though A.class and bean a is in spring container, the bean 'myBean' always loaded in spring ,the @ConditionOnMissingBean likes unaviable . But I remove @RefreshScope, it works normal and the bean 'myBean' is not loader in spring.
this is my code
springboot version is 3.3.4,cloud-config version is 4.1.2
`
@SpringBootApplication
public class ReactiveApplication {
}
`
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?
The text was updated successfully, but these errors were encountered: