我正在尝试使用将spring boot项目连接到kafka。在我的application.properties文件中,我具有以下配置:
spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer
spring.kafka.consumer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
spring.kafka.consumer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer
spring.kafka.template.default-topic=my_default_topic
spring.kafka.admin.fail-fast=true
spring.kafka.consumer.auto-offset-reset=latest
spring.kafka.consumer.group-id=my_group_id
spring.kafka.listener.concurrency=10
spring.kafka.bootstrap-servers=kafka:9092
Run Code Online (Sandbox Code Playgroud)
但是在日志中,我看到只有这些值中的一部分才进入消耗配置。日志中的配置在这里:
2018-08-01 15:20:34.640 WARN 1 --- [ main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refr[3/5548]
mpt: org.springframework.context.ApplicationContextException: Failed to start bean 'org.springframework.kafka.config.internalKafkaListenerEndpointRegistry'; nested exception is org.apache.kafka.common.KafkaException: Failed to cons[2/5548]
fka consumer [1/5548]
isolation.level = read_uncommitted [46/5548]
key.deserializer = class org.apache.kafka.common.serialization.StringDeserializer [45/5548]
max.partition.fetch.bytes = 1048576 [44/5548]
max.poll.interval.ms = 300000 [43/5548]
check.crcs = true [58/5548]
client.id =
connections.max.idle.ms = 540000
enable.auto.commit = true
exclude.internal.topics = true
fetch.max.bytes …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用与此类似的 keycloak CLI 创建 IDP 提供程序映射器

文档中的示例均适用于存储映射器。
我试过了
kcadm.sh create components -r my-realm -s name=my-mapper-name -s providerId=oidc-hardcoded-role-idp-mapper -s providerType=org.keycloak.broker.provider.IdentityProviderMapper -s parentId=<parent id> -s 'config.role=["ROLE_MY_ROLE"]'
Run Code Online (Sandbox Code Playgroud)
但这因错误而失败
14:45:26,325 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (default task-7) Uncaught server error: java.lang.ClassCastException: class org.keycloak.broker.provider.HardcodedRoleMapper cannot be cast to class org.keycloak.component.ComponentFactory (org.keycloak.broker.provider.HardcodedRoleMapper is in unnamed module of loader 'org.keycloak.keycloak-services@9.0.0' @1dd6d570; org.keycloak.component.ComponentFactory is in unnamed module of loader 'org.keycloak.keycloak-server-spi@9.0.0' @8467851)
Run Code Online (Sandbox Code Playgroud)
因为与它不同,HardcodedLDAPRoleStorageMapperFactory它不会扩展ComponentFactory.
是否可以使用 keycloak CLI 来做到这一点?
谢谢你!