So I need to override a bean provided by a dependency in order to customize some configuration.
Is there any way to allow overriding just for THAT particular name?
I don't want to set
spring.main.allow-bean-definition-overriding=true
That's scary. I just want to override one particular named bean and disallow overriding in all other instances.
** EDIT **
@Bean
@Primary
fun vaadinAuthenticationSuccessHandler(
httpService: HttpService,
vaadinRedirectStrategy: VaadinRedirectStrategy
): VaadinAuthenticationSuccessHandler {
return VaadinUrlAuthenticationSuccessHandler(httpService, vaadinRedirectStrategy, "/")
}
results in
The bean 'vaadinAuthenticationSuccessHandler', defined in class path resource [n/c/s/config/security/VaadinAwareSecurityConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/vaadin/spring/security/config/VaadinSharedSecurityConfiguration.class] and overriding is disabled.
It's worth noting that similar code I've seen actually uses
@Bean(name = VaadinSharedSecurityConfiguration.VAADIN_AUTHENTICATION_SUCCESS_HANDLER_BEAN)
(which doesn't make a difference, but it's worth noting all the same)