'Example keycloak spring-boot app fails to find bean KeycloakSpringBootConfigResolver
I'm trying to run example app from:
https://github.com/keycloak/keycloak-quickstarts/tree/latest/app-springboot
I'm getting error:
***************************
APPLICATION FAILED TO START
***************************
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.
Process finished with exit code 1
Solution 1:[1]
Thomas answer did work for me. The keycloak spring boot properties class had to be enabled manually though, by annotating the Application class like this:
@EnableConfigurationProperties(KeycloakSpringBootProperties.class)
Furthermore the custom keycloak spring boot config resolver bean must be overriden explicitly.
@Bean
@Primary
public KeycloakConfigResolver keycloakConfigResolver(KeycloakSpringBootProperties properties) {
return new MyKeycloakSpringBootConfigResolver(properties);
}
Solution 2:[2]
I could solve this problem by adding some annotations in the KeycloakConfig class declaration:
@EnableWebSecurity
@ComponentScan(basePackageClasses = KeycloakSecurityComponents.class,
excludeFilters = @ComponentScan.Filter(type = FilterType.REGEX,
pattern = "org.keycloak.adapters.springsecurity.management.HttpSessionManager"))
public class KeycloakSecurityConfig extends KeycloakWebSecurityConfigurerAdapter
{
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Tamim |
| Solution 2 | Expedito JĂșnior |
