diff --git a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/CacheProcessor.java b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/CacheProcessor.java index e03af658f6325..d4c334731abd0 100644 --- a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/CacheProcessor.java +++ b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/CacheProcessor.java @@ -1,9 +1,10 @@ package io.quarkus.qute.deployment; +import java.util.Optional; + import io.quarkus.arc.deployment.AdditionalBeanBuildItem; import io.quarkus.cache.deployment.spi.AdditionalCacheNameBuildItem; -import io.quarkus.deployment.Capabilities; -import io.quarkus.deployment.Capability; +import io.quarkus.cache.deployment.spi.CacheTypeBuildItem; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.qute.cache.QuteCache; @@ -11,13 +12,19 @@ public class CacheProcessor { @BuildStep - void initialize(Capabilities capabilities, BuildProducer beans, + void initialize(Optional cacheTypeBuildItem, + BuildProducer beans, BuildProducer cacheNames) { - if (capabilities.isPresent(Capability.CACHE)) { - beans.produce(new AdditionalBeanBuildItem("io.quarkus.qute.runtime.cache.CacheConfigurator")); - // We need to produce additional cache name because quarkus-cache only considers the CombinedIndexBuildItem and not the bean archive index - cacheNames.produce(new AdditionalCacheNameBuildItem(QuteCache.NAME)); + if (cacheTypeBuildItem.isEmpty()) { // no caching enabled + return; + } + CacheTypeBuildItem.Type type = cacheTypeBuildItem.get().getType(); + if (type != CacheTypeBuildItem.Type.LOCAL) { // it does not make sense to use a remote cache for Qute + return; } + beans.produce(new AdditionalBeanBuildItem("io.quarkus.qute.runtime.cache.CacheConfigurator")); + // We need to produce additional cache name because quarkus-cache only considers the CombinedIndexBuildItem and not the bean archive index + cacheNames.produce(new AdditionalCacheNameBuildItem(QuteCache.NAME)); } }