运行示例keycloak spring-boot应用程序时出现问题

我正在尝试从运行示例应用程序:

https://github.com/keycloak/keycloak-quickstarts/tree/latest/app-

springboot

我收到错误消息:

***************************

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

回答:

我目前没有解决方案,但是我可以看到几个月前在Keycloak

Jira上已经注册了完全相同的问题:https

://issues.jboss.org/browse/KEYCLOAK-10595

。该问题似乎是由此PR随附的代码引起的:https :

//github.com/keycloak/keycloak/pull/6075。

PR的作者以这种方式描述了这个问题:“唯一剩下的问题是,解析器通常使用KeycloakAutoConfiguration(在我的示例中为SharedConfiguration)包含在配置中,因此您尝试在配置时访问bean。可以通过将解析器bean移到另一个必须在KeycloakAutoConfiguration之前加载的配置中来解决。(来源:https :

//issues.jboss.org/browse/KEYCLOAK-10334?focusedCommentId=13738518&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-

tabpanel#comment-13738518)


关于Keycloak

Jira(https://issues.jboss.org/browse/KEYCLOAK-11282)的问题,建议采取临时解决方法。

@Configuration

public class MyKeycloakSpringBootConfigResolver extends KeycloakSpringBootConfigResolver {

private final KeycloakDeployment keycloakDeployment;

public MyKeycloakSpringBootConfigResolver(KeycloakSpringBootProperties properties) {

keycloakDeployment = KeycloakDeploymentBuilder.build(properties);

}

@Override

public KeycloakDeployment resolve(HttpFacade.Request facade) {

return keycloakDeployment;

}

}


解决问题的更简单方法是KeycloakSpringBootConfigResolver在单独的配置类中声明a 。该选项将解决Spring

Boot和Spring Security的问题。

@Configuration

public class KeycloakConfig {

@Bean

public KeycloakSpringBootConfigResolver keycloakConfigResolver() {

return new KeycloakSpringBootConfigResolver();

}

}

以上是 运行示例keycloak spring-boot应用程序时出现问题 的全部内容, 来源链接: utcz.com/qa/425785.html

回到顶部