diff --git a/orion-visor-framework/orion-visor-spring-boot-starter-redis/pom.xml b/orion-visor-framework/orion-visor-spring-boot-starter-redis/pom.xml
index 096f6547..a33a408a 100644
--- a/orion-visor-framework/orion-visor-spring-boot-starter-redis/pom.xml
+++ b/orion-visor-framework/orion-visor-spring-boot-starter-redis/pom.xml
@@ -36,6 +36,12 @@
io.netty
netty-all
+
+
+
+ com.github.fppt
+ jedis-mock
+
\ No newline at end of file
diff --git a/orion-visor-framework/orion-visor-spring-boot-starter-redis/src/main/java/org/dromara/visor/framework/redis/configuration/OrionNoRedisAutoConfiguration.java b/orion-visor-framework/orion-visor-spring-boot-starter-redis/src/main/java/org/dromara/visor/framework/redis/configuration/OrionNoRedisAutoConfiguration.java
new file mode 100644
index 00000000..6ef6a1f0
--- /dev/null
+++ b/orion-visor-framework/orion-visor-spring-boot-starter-redis/src/main/java/org/dromara/visor/framework/redis/configuration/OrionNoRedisAutoConfiguration.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2023 - present Dromara, All rights reserved.
+ *
+ * https://visor.dromara.org
+ * https://visor.dromara.org.cn
+ * https://visor.orionsec.cn
+ *
+ * Members:
+ * Jiahang Li - ljh1553488six@139.com - author
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.dromara.visor.framework.redis.configuration;
+
+import com.github.fppt.jedismock.RedisServer;
+import org.dromara.visor.common.constant.AutoConfigureOrderConst;
+import org.dromara.visor.common.interfaces.Locker;
+import org.dromara.visor.common.utils.LockerUtils;
+import org.springframework.boot.autoconfigure.AutoConfiguration;
+import org.springframework.boot.autoconfigure.AutoConfigureOrder;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
+import redis.clients.jedis.JedisPoolConfig;
+
+import java.net.InetAddress;
+import java.util.function.Supplier;
+
+/**
+ * noRedis 配置
+ * 仅用于本地调试无 redis 的情况
+ *
+ * @author Jiahang Li
+ * @version 1.0.0
+ * @since 2024/12/26 10:02
+ */
+@ConditionalOnProperty(value = "no.redis", havingValue = "true")
+@AutoConfiguration
+@AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_REDIS - 10)
+public class OrionNoRedisAutoConfiguration {
+
+ /**
+ * @return mocked redis server
+ */
+ @Bean
+ public RedisServer redisServer(RedisProperties properties) {
+ RedisServer server = new RedisServer(properties.getPort(), InetAddress.getLoopbackAddress());
+ try {
+ server.start();
+ } catch (Exception ignore) {
+ }
+ return server;
+ }
+
+ /**
+ * @return mocked jedis factory
+ */
+ @Bean
+ public JedisConnectionFactory jedisConnectionFactory(RedisServer redisServer) {
+ JedisConnectionFactory factory = new JedisConnectionFactory();
+ factory.setHostName(redisServer.getHost());
+ factory.setPort(redisServer.getBindPort());
+ factory.setUsePool(true);
+ factory.setPoolConfig(new JedisPoolConfig());
+ return factory;
+ }
+
+ /**
+ * @return mocked redis locker
+ */
+ @Bean
+ public Locker redisLocker() {
+ Locker locker = new Locker() {
+ @Override
+ public boolean tryLock(String key, Runnable run) {
+ run.run();
+ return true;
+ }
+
+ @Override
+ public T tryLock(String key, Supplier call) {
+ return call.get();
+ }
+ };
+ LockerUtils.setDelegate(locker);
+ return locker;
+ }
+
+}
diff --git a/orion-visor-framework/orion-visor-spring-boot-starter-redis/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/orion-visor-framework/orion-visor-spring-boot-starter-redis/src/main/resources/META-INF/additional-spring-configuration-metadata.json
index 742bca9f..51558866 100644
--- a/orion-visor-framework/orion-visor-spring-boot-starter-redis/src/main/resources/META-INF/additional-spring-configuration-metadata.json
+++ b/orion-visor-framework/orion-visor-spring-boot-starter-redis/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -24,6 +24,12 @@
"type": "java.lang.Integer",
"description": "最小空闲连接数.",
"defaultValue": "16"
+ },
+ {
+ "name": "no.redis",
+ "type": "java.lang.Boolean",
+ "description": "是否无 redis.",
+ "defaultValue": false
}
]
}
\ No newline at end of file
diff --git a/orion-visor-framework/orion-visor-spring-boot-starter-redis/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/orion-visor-framework/orion-visor-spring-boot-starter-redis/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
index 87d2d384..cccc4c8f 100644
--- a/orion-visor-framework/orion-visor-spring-boot-starter-redis/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
+++ b/orion-visor-framework/orion-visor-spring-boot-starter-redis/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -1,2 +1,3 @@
+org.dromara.visor.framework.redis.configuration.OrionNoRedisAutoConfiguration
org.dromara.visor.framework.redis.configuration.OrionRedisAutoConfiguration
org.dromara.visor.framework.redis.configuration.OrionCacheAutoConfiguration
\ No newline at end of file
diff --git a/orion-visor-launch/src/main/resources/application-dev.yaml b/orion-visor-launch/src/main/resources/application-dev.yaml
index d5a313c7..b8e04dc2 100644
--- a/orion-visor-launch/src/main/resources/application-dev.yaml
+++ b/orion-visor-launch/src/main/resources/application-dev.yaml
@@ -35,3 +35,6 @@ mybatis-plus:
configuration:
# sql 日志打印
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+
+no:
+ redis: false