我已经用这个罐子将Redis与Micronaut集成在一起。 编译“ io.micronaut.configuration:micronaut-redis-lettuce” 默认情况下,即使我在我的micronaut应用程序中禁用了运行状况终点,也启用了redis运行状况检查。 https://micronaut-projects.github.io/micronaut-redis/latest/guide/
以下是我每100秒收到一次异常的情况,因为我将运行状况间隔配置为 micronaut.health.monitor.interval:100秒
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)```
答案 0 :(得分:0)
在application.properties中将此参数设置为false可解决该问题。
micronaut.health.monitor.enabled=false