Uploaded image for project: 'Keycloak'
  1. Keycloak
  2. KEYCLOAK-8813

BeanDefinitionOverrideException when using keycloak spring library

    Details

      Description

      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.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  davidbilge David Bilge
                • Votes:
                  2 Vote for this issue
                  Watchers:
                  8 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: