This commit is contained in:
yuhaiming
2026-09-16 10:11:41 +08:00
commit 926426fe4f
901 changed files with 103701 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ruoyi-common-elasticsearch</artifactId>
<description>
ruoyi-common-elasticsearch ES搜索引擎服务
</description>
<dependencies>
<!-- Easy-Es 搜索引擎 -->
<dependency>
<groupId>org.dromara.easy-es</groupId>
<artifactId>easy-es-boot-starter</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,37 @@
package org.dromara.common.elasticsearch.config;
import org.springframework.boot.EnvironmentPostProcessor;
import org.springframework.boot.SpringApplication;
import org.springframework.core.Ordered;
import org.springframework.core.env.ConfigurableEnvironment;
/**
* 健康检查配置注入
*
* @author Lion Li
*/
public class ActuatorEnvironmentPostProcessor implements EnvironmentPostProcessor, Ordered {
/**
* 根据 easy-es 开关同步设置 Elasticsearch 健康检查开关。
*
* @param environment Spring 环境配置
* @param application Spring 应用实例
*/
@Override
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
String enable = environment.getProperty("easy-es.enable", "false");
System.setProperty("management.health.elasticsearch.enabled", enable);
}
/**
* 返回环境后处理器执行顺序。
*
* @return 最高优先级
*/
@Override
public int getOrder() {
return Ordered.HIGHEST_PRECEDENCE;
}
}

View File

@@ -0,0 +1,17 @@
package org.dromara.common.elasticsearch.config;
import org.dromara.easyes.spring.annotation.EsMapperScan;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
/**
* easy-es 配置
*
* @author Lion Li
*/
@AutoConfiguration
@ConditionalOnProperty(value = "easy-es.enable", havingValue = "true")
@EsMapperScan("org.dromara.**.esmapper")
public class EasyEsConfiguration {
}

View File

@@ -0,0 +1,2 @@
org.springframework.boot.EnvironmentPostProcessor=\
org.dromara.common.elasticsearch.config.ActuatorEnvironmentPostProcessor

View File

@@ -0,0 +1 @@
org.dromara.common.elasticsearch.config.EasyEsConfiguration