Keycloak 17:类型 org.keycloak.models.KeycloakSession 和限定符 [@Default] 的不满足依赖关系
Keycloak 17: Unsatisfied dependency for type org.keycloak.models.KeycloakSession and qualifiers [@Default]
我们使用 keycloak 作为 IDP 并有一些自定义 plugins/Spi,我们正在将我们的 keycloak 实例更新到版本 17 Quarkas 分发并且 SPI 在 keycloak 构建过程中开始中断(错误如下)。我已经确保没有 keycloak 库作为 jar 的一部分打包。
SPI 如下所示,在 Manifest/services/org.keycloak.services.resource.RealmResourceProviderFactory
下的清单文件中有相应的条目
自定义SPI/plugin
public class SwaggerJsonRetrieverFactory implements RealmResourceProviderFactory {
@Override
public RealmResourceProvider create(KeycloakSession session) {
return new SwaggerJsonRetriever(session);
}
@Override
public void init(Config.Scope config) {
}
@Override
public void postInit(KeycloakSessionFactory factory) {
}
@Override
public void close() {
}
@Override
public String getId() {
return "swagger.json";
}
}
我的 pom.xml 如下所示
<dependencies>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-core</artifactId>
<scope>provided</scope>
<version>${keycloak.version}</version>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-server-spi</artifactId>
<version>${keycloak.version}</version>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-services</artifactId>
<scope>provided</scope>
<version>${keycloak.version}</version>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-server-spi-private</artifactId>
<scope>provided</scope>
<version>${keycloak.version}</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-parser</artifactId>
<version>1.0.22</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>${jackson-dataformat-yaml.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.ws.rs</groupId>
<artifactId>jboss-jaxrs-api_2.1_spec</artifactId>
<version>2.0.1.Final</version>
</dependency>
</dependencies>
我遇到的错误
io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: Found 2 deployment problems:
[1] Unsatisfied dependency for type org.keycloak.models.KeycloakSession and qualifiers [@Default]
- java member: com.abc.swagger.SwaggerJsonRetriever().session
- declared on CLASS bean [types=[com.abc.swagger.SwaggerJsonRetriever, java.lang.Object], qualifiers=[@Default, @Any], target=com.abc.swagger.SwaggerJsonRetriever]
[2] Unsatisfied dependency for type org.keycloak.models.KeycloakSession and qualifiers [@Default]
是否有任何我遗漏的配置,将不胜感激。
从 class 中删除 @Path 注释。
我们使用 keycloak 作为 IDP 并有一些自定义 plugins/Spi,我们正在将我们的 keycloak 实例更新到版本 17 Quarkas 分发并且 SPI 在 keycloak 构建过程中开始中断(错误如下)。我已经确保没有 keycloak 库作为 jar 的一部分打包。
SPI 如下所示,在 Manifest/services/org.keycloak.services.resource.RealmResourceProviderFactory
下的清单文件中有相应的条目自定义SPI/plugin
public class SwaggerJsonRetrieverFactory implements RealmResourceProviderFactory {
@Override
public RealmResourceProvider create(KeycloakSession session) {
return new SwaggerJsonRetriever(session);
}
@Override
public void init(Config.Scope config) {
}
@Override
public void postInit(KeycloakSessionFactory factory) {
}
@Override
public void close() {
}
@Override
public String getId() {
return "swagger.json";
}
}
我的 pom.xml 如下所示
<dependencies>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-core</artifactId>
<scope>provided</scope>
<version>${keycloak.version}</version>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-server-spi</artifactId>
<version>${keycloak.version}</version>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-services</artifactId>
<scope>provided</scope>
<version>${keycloak.version}</version>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-server-spi-private</artifactId>
<scope>provided</scope>
<version>${keycloak.version}</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-parser</artifactId>
<version>1.0.22</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>${jackson-dataformat-yaml.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.ws.rs</groupId>
<artifactId>jboss-jaxrs-api_2.1_spec</artifactId>
<version>2.0.1.Final</version>
</dependency>
</dependencies>
我遇到的错误
io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: Found 2 deployment problems:
[1] Unsatisfied dependency for type org.keycloak.models.KeycloakSession and qualifiers [@Default]
- java member: com.abc.swagger.SwaggerJsonRetriever().session
- declared on CLASS bean [types=[com.abc.swagger.SwaggerJsonRetriever, java.lang.Object], qualifiers=[@Default, @Any], target=com.abc.swagger.SwaggerJsonRetriever]
[2] Unsatisfied dependency for type org.keycloak.models.KeycloakSession and qualifiers [@Default]
是否有任何我遗漏的配置,将不胜感激。
从 class 中删除 @Path 注释。