如何在redis-lettuce与micronaut集成时禁用Redis健康检查

92dk7w1h  于 2023-04-29  发布在  Redis
关注(0)|答案(2)|浏览(276)

我已经用这个jar集成redis与micronaut。compile 'io.micronaut.configuration:micronaut-redis-lettuce '默认情况下,即使我在micronaut应用程序中禁用了健康端点,也会启用redis健康检查。https://micronaut-projects.github.io/micronaut-redis/latest/guide/
下面是我每100秒得到的异常,因为我将健康间隔配置为
micronaut。health.monitor.间隔:100 s

Path Taken: new HealthMonitorTask(CurrentHealthStatus currentHealthStatus,[List healthIndicators]) --> new RedisHealthIndicator(BeanContext beanContext,[HealthAggregator healthAggregator],StatefulRedisConnection[] connections)
io.micronaut.context.exceptions.DependencyInjectionException: Failed to inject value for parameter [healthAggregator] of class: io.micronaut.configuration.lettuce.health.RedisHealthIndicator

Message: No bean of type [io.micronaut.management.health.aggregator.HealthAggregator] exists. Make sure the bean is not disabled by bean requirements (enable trace logging for 'io.micronaut.context.condition' to check) and if the bean is enabled then ensure the class is declared a bean and annotation processing is enabled (for Java and Kotlin the 'micronaut-inject-java' dependency should be configured as an annotation processor).
Path Taken: new HealthMonitorTask(CurrentHealthStatus currentHealthStatus,[List healthIndicators]) --> new RedisHealthIndicator(BeanContext beanContext,[HealthAggregator healthAggregator],StatefulRedisConnection[] connections)
    at io.micronaut.context.AbstractBeanDefinition.getBeanForConstructorArgument(AbstractBeanDefinition.java:990)
    at io.micronaut.configuration.lettuce.health.$RedisHealthIndicatorDefinition.build(Unknown Source)
    at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1494)
    at io.micronaut.context.DefaultBeanContext.addCandidateToList(DefaultBeanContext.java:2507)
    at io.micronaut.context.DefaultBeanContext.getBeansOfTypeInternal(DefaultBeanContext.java:2429)
    at io.micronaut.context.DefaultBeanContext.getBeansOfType(DefaultBeanContext.java:854)
    at io.micronaut.context.AbstractBeanDefinition.lambda$getBeansOfTypeForConstructorArgument$10(AbstractBeanDefinition.java:1088)
    at io.micronaut.context.AbstractBeanDefinition.resolveBeanWithGenericsFromConstructorArgument(AbstractBeanDefinition.java:1697)
    at io.micronaut.context.AbstractBeanDefinition.getBeansOfTypeForConstructorArgument(AbstractBeanDefinition.java:1083)
    at io.micronaut.context.AbstractBeanDefinition.getBeanForConstructorArgument(AbstractBeanDefinition.java:962)```
mpgws1up

mpgws1up1#

这对我很有效:

redis.health.enabled: false
up9lanfz

up9lanfz2#

在www.example中将此参数设置为false www.example.com 解决了它。micronaut.health.monitor.enabled=false

相关问题