When using Keycloak client library with Spring Boot, Spring will throw an BeanDefinitionOverrideException.
The problem is that the HttpSessionManager is defined twice:
- The KeycloakWebSecurityConfigurerAdapter (that you are supposed to extend with an own configuration class) has a method httpSessionManager() annotated with @Bean
- The HttpSessionManager itself is annotated with @Component and is thus being picked up by the component scan that is defined on the @KeycloakConfiguration meta-annotation that you are supposed to annotate the configuration class with
A workaround is to configure spring.main.allow-bean-definition-overriding: true via the spring properties (like, in the application.yml) but the out-of-the-box experience is, frankly, lacking.