diff --git a/ruoyi-common/ruoyi-common-elasticsearch/src/main/java/com/ruoyi/common/elasticsearch/config/ActuatorEnvironmentPostProcessor.java b/ruoyi-common/ruoyi-common-elasticsearch/src/main/java/com/ruoyi/common/elasticsearch/config/ActuatorEnvironmentPostProcessor.java new file mode 100644 index 00000000..c6f67c1b --- /dev/null +++ b/ruoyi-common/ruoyi-common-elasticsearch/src/main/java/com/ruoyi/common/elasticsearch/config/ActuatorEnvironmentPostProcessor.java @@ -0,0 +1,25 @@ +package com.ruoyi.common.elasticsearch.config; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.env.EnvironmentPostProcessor; +import org.springframework.core.Ordered; +import org.springframework.core.env.ConfigurableEnvironment; + +/** + * 健康检查配置注入 + * + * @author Lion Li + */ +public class ActuatorEnvironmentPostProcessor implements EnvironmentPostProcessor, Ordered { + + @Override + public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { + System.setProperty("management.health.elasticsearch.enabled", "false"); + } + + @Override + public int getOrder() { + return Ordered.HIGHEST_PRECEDENCE; + } + +} diff --git a/ruoyi-common/ruoyi-common-elasticsearch/src/main/resources/META-INF/spring.factories b/ruoyi-common/ruoyi-common-elasticsearch/src/main/resources/META-INF/spring.factories new file mode 100644 index 00000000..1dbf1036 --- /dev/null +++ b/ruoyi-common/ruoyi-common-elasticsearch/src/main/resources/META-INF/spring.factories @@ -0,0 +1,2 @@ +org.springframework.boot.env.EnvironmentPostProcessor=\ + com.ruoyi.common.elasticsearch.config.ActuatorEnvironmentPostProcessor