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
I'm trying to integrate RefreshScope in my project.
The problem is that @ConditionalOnBean condition doesn't match bean, annotated with @RefreshScope.
It works fine with Spring Boot 2.1.4.RELEASE, but doesn't work with version 2.6.6.
Is it expected behaviour or it's a bug?
My expectations is that refresh scope bean proxy should trigger real bean creation, because it's injected in provider and it shouldn't be blocked by @ConditionalOnBean condition.
Example
I have three autoconfigurations, executing one after another. TokenProviderAutoConfiguration depends on bean, which can be created or not in TokenClientAutoConfiguration. On this bean I added @RefreshScope. After that TokenProviderAutoConfiguration didn't added to context, because of @ConditionalOnBean condition (but only in later Spring Boot version)
I have similar but different problem where my configuration class annotated with @RefreshScope and method annotated with @Bean registers BeanDefinition with null BeanClass. ConditionalOnMissingBean checks match using beanclass so it creates another bean with type even if refreshscope bean already exist
Hi!
I'm trying to integrate RefreshScope in my project.
The problem is that
@ConditionalOnBean
condition doesn't match bean, annotated with@RefreshScope
.It works fine with Spring Boot 2.1.4.RELEASE, but doesn't work with version 2.6.6.
I have debugged and found, that the root cause is in this line:
https://github.com/spring-projects/spring-boot/blob/d4a91004b5b04f0151e9b5df65dceb6443a35e42/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java#L186
Is it expected behaviour or it's a bug?
My expectations is that refresh scope bean proxy should trigger real bean creation, because it's injected in provider and it shouldn't be blocked by
@ConditionalOnBean
condition.Example
I have three autoconfigurations, executing one after another.
TokenProviderAutoConfiguration
depends on bean, which can be created or not inTokenClientAutoConfiguration
. On this bean I added@RefreshScope
. After thatTokenProviderAutoConfiguration
didn't added to context, because of@ConditionalOnBean
condition (but only in later Spring Boot version)The text was updated successfully, but these errors were encountered: