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
In Spring Boot, I'd like to be able to override a method in a Spring Data REST configuration class to make it conditional, however this doesn't work. The condition on the overriding method is evaluated and correctly considered as not matching but the overridden method is then also considered. It has no conditions so a bean definition is created.
I've revised ConfigurationClassBeanDefinitionReader's registration algorithm to keep track of skipped beans within a configuration class, not allowing registration of the same bean in a superclass thereof. This is bean name based instead of override based since we allow conceptual overriding through a same-named @Bean method but with a different signature.
Andy Wilkinson opened SPR-12694 and commented
In Spring Boot, I'd like to be able to override a method in a Spring Data REST configuration class to make it conditional, however this doesn't work. The condition on the overriding method is evaluated and correctly considered as not matching but the overridden method is then also considered. It has no conditions so a bean definition is created.
This is illustrated by this test:
My expectation is that the condition will prevent the
Baz
bean from being created.Affects: 4.1.4
Reference URL: spring-projects/spring-boot#2267
Issue Links:
@Bean
declarations with same primary bean name do not work anymore@Profile
declarations on overloaded@Bean
methods0 votes, 5 watchers
The text was updated successfully, but these errors were encountered: