Spring Keycloak身份验证服务器中缺少导入

问题描述

我目前正在阅读本指南,以了解如何将密钥斗篷集成到Spring Boot中: https://www.baeldung.com/keycloak-embedded-in-spring-boot-app

我用https://start.spring.io/创建了我的项目,并添加了教程中所有需要的依赖项。

我还实现了KeycloakServerProperties.java中所需的吸气剂,所以现在看起来像这样:

@ConfigurationProperties(prefix = "keycloak.server")
public class KeycloakServerProperties {
    String contextpath = "/auth";
    String realmImportFile = "baeldung-realm.json";
    AdminUser adminUser = new AdminUser();
 
    public AdminUser getAdminUser(){
        return this.adminUser;
    }
    
    public String getRealmImportFile(){
        return this.realmImportFile;
    }

    public String getcontextpath(){
        return this.contextpath;
    }
 
    public static class AdminUser {
        String username = "admin";
        String password = "admin";
 
        public String getUsername(){
            return this.username;
        }

        public String getpassword(){
            return this.password;
        }      
    }
}

我的问题现在出在EmbeddedKeycloakApplication.java和EmbeddedKeycloakConfig.java

名称无法解析为类型”有很多错误 我将项目按原样上传到这里:https://drive.google.com/file/d/1iuxeBcfX_cmSVIfE8tBftmHLfStCyCF6/view?usp=sharing

我认为我缺少本教程没有提到的必需软件包或导入。

此外,搜索类型名称也无济于事。

我缺少哪些进口商品?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)