1

I want to setup the Keycloak adapter (v7.0.0) for a Spring Boot 2.1.x backend. Somehow this doesn't work as expected and mvn clean spring:boot-run shows errors.

To get a playground i cloned this working repo. After a successful build with the old versions of Keycloak and Spring Boot i changed the dependencies (and versions).

For the POM i included:

<dependency>
  <groupId>org.keycloak</groupId>
  <artifactId>keycloak-spring-boot-starter</artifactId>
  <version>7.0.0</version>
</dependency>

and

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.keycloak.bom</groupId>
        <artifactId>keycloak-adapter-bom</artifactId>
        <version>7.0.0</version>
        <type>pom</type>
        <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>

and provide properties via the application.yml file:

keycloak:
  auth-server-url: http://127.0.0.1:8081/auth/
  resource: persons-app
  realm: PersonRealm
  public-client: true
  principal-attribute: preferred_username

This follows Keycloaks docs.

The result is an error showing:

Description:

Parameter 1 of method setKeycloakSpringBootProperties in org.keycloak.adapters.springboot.KeycloakBaseSpringBootConfiguration required a bean of type 'org.keycloak.adapters.springboot.KeycloakSpringBootConfigResolver' that could not be found.


Action:

Consider defining a bean of type 'org.keycloak.adapters.springboot.KeycloakSpringBootConfigResolver' in your configuration.

This is already defined. So thats the problem. I don't know if there are certain restriction of what versions of Keycloak and Spring Boot work together. Maybe someone could explain what i missed here or what versions to set. Thanks!

norb
  • 77
  • 1
  • 10
  • Possible duplicate of [Issues running example keycloak spring-boot app](https://stackoverflow.com/questions/57787768/issues-running-example-keycloak-spring-boot-app) – Joe Sep 05 '19 at 14:38

1 Answers1

1

The same question has been asked here: Issues running example keycloak spring-boot app I'll point you to the other one for more information about the issue and a temporary workaround.

At the moment there is no ultimate solution, it's an issue with the Keycloak Spring Boot Adapter 7.0.0. If you use the previous version of the adapter (6.0.1) then it will work fine, even if the Keycloak server is running version 7.0.0 (you just don't get the new features introduced in the new adapter).

Thomas Vitale
  • 1,588
  • 10
  • 13