[keycloak-user] keycloak 4.5 client integration with spring boot and spring security problem

ZKX z_88 at yahoo.com
Thu Oct 4 11:50:29 EDT 2018


We are doing a POC with a spring boot/security project with keycloak. 
Initially we only had keycloak-spring-boot-starter without directly reference with spring security. It is very straightforward with just setting the keycloak properties in the application.properties file.
Later on we need to use @PreAuthorize("hasRole('admin')") to enforce security check on some services, therefore, we added spring security library with additional security configuration:
as mentioned in the keycloak document.  Mostly as the described in this tutorial: https://www.baeldung.com/spring-boot-keycloak
Everything works fine with keycloak 4.3/4.4, we still can use the keycloak config in application.properties file together with spring security, since we had following code in our spring boot configuration:    @Bean    public KeycloakSpringBootConfigResolver KeycloakConfigResolver() {        return new KeycloakSpringBootConfigResolver();    }
However, recently we upgrade our spring boot keycloak starter to 4.5, and our application failed to start with following error:
Error creating bean with name 'KeycloakSpringBootConfigResolver': Requested bean is currently in creation: Is there an unresolvable circular reference?

Just wondering how to resolve this?Anyone use spring boot with spring security together with keycloak starter 4.5 successfully? 
Thanks,Kevin


More information about the keycloak-user mailing list