diff --git a/libs/micronaut-snitch/src/main/java/com/agorapulse/micronaut/snitch/DefaultSnitchFactory.java b/libs/micronaut-snitch/src/main/java/com/agorapulse/micronaut/snitch/DefaultSnitchFactory.java index 83be6de..c243110 100644 --- a/libs/micronaut-snitch/src/main/java/com/agorapulse/micronaut/snitch/DefaultSnitchFactory.java +++ b/libs/micronaut-snitch/src/main/java/com/agorapulse/micronaut/snitch/DefaultSnitchFactory.java @@ -18,6 +18,8 @@ package com.agorapulse.micronaut.snitch; import io.micronaut.context.annotation.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.inject.Named; import javax.inject.Singleton; @@ -28,6 +30,8 @@ @Factory public class DefaultSnitchFactory { + private static final Logger LOGGER = LoggerFactory.getLogger(DefaultSnitchFactory.class); + @EachBean(SnitchJobConfiguration.class) @Requires(property = "snitches.jobs") public SnitchService snitchService(SnitchClient client, SnitchJobConfiguration configuration) { @@ -49,7 +53,11 @@ public SnitchService defaultSnitchService(SnitchClient client, @Value("${snitche @Singleton @Named("default") @Requires(missingProperty = "snitches.id") - public SnitchService noopSnitchService() { + public SnitchService noopSnitchService(@Value("${snitches.disabled:false}") boolean snitchesDisabled) { + if (!snitchesDisabled) { + LOGGER.warn("Micronaut Snitch is not configured! Please set snitches.id configuration property or set snitches.disabled to true to ignore this warning."); + } + return NoopSnitchService.INSTANCE; }