From 5801fd414f9be87dd6c848c559cde975b9106aef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Mon, 15 Aug 2022 22:43:52 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20easy-es.enable=3D?= =?UTF-8?q?false=20=E5=85=B3=E9=97=AD=20actuator=20=E5=81=A5=E5=BA=B7?= =?UTF-8?q?=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ActuatorEnvironmentPostProcessor.java | 25 +++++++++++++++++++ .../main/resources/META-INF/spring.factories | 2 ++ 2 files changed, 27 insertions(+) create mode 100644 ruoyi-common/ruoyi-common-elasticsearch/src/main/java/com/ruoyi/common/elasticsearch/config/ActuatorEnvironmentPostProcessor.java create mode 100644 ruoyi-common/ruoyi-common-elasticsearch/src/main/resources/META-INF/spring.factories 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