🔧 修改 redisson 配置.
This commit is contained in:
@@ -1,9 +1,12 @@
|
|||||||
package com.orion.ops.framework.redis.config;
|
package com.orion.ops.framework.redis.config;
|
||||||
|
|
||||||
import com.orion.ops.framework.common.constant.AutoConfigureOrderConst;
|
import com.orion.ops.framework.common.constant.AutoConfigureOrderConst;
|
||||||
|
import com.orion.ops.framework.redis.core.config.RedissonConfig;
|
||||||
import com.orion.ops.framework.redis.core.utils.RedisUtils;
|
import com.orion.ops.framework.redis.core.utils.RedisUtils;
|
||||||
|
import org.redisson.spring.starter.RedissonAutoConfigurationCustomizer;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
|
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
|
||||||
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
@@ -20,6 +23,7 @@ import org.springframework.data.redis.serializer.RedisSerializer;
|
|||||||
@Lazy(value = false)
|
@Lazy(value = false)
|
||||||
@AutoConfiguration
|
@AutoConfiguration
|
||||||
@AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_REDIS)
|
@AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_REDIS)
|
||||||
|
@EnableConfigurationProperties(RedissonConfig.class)
|
||||||
public class OrionRedisAutoConfiguration {
|
public class OrionRedisAutoConfiguration {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,5 +44,17 @@ public class OrionRedisAutoConfiguration {
|
|||||||
return redisTemplate;
|
return redisTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param redissonConfig config
|
||||||
|
* @return redisson 自定义配置
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public RedissonAutoConfigurationCustomizer redissonConfigurationCustomizer(RedissonConfig redissonConfig) {
|
||||||
|
return config -> {
|
||||||
|
config.setThreads(redissonConfig.getThreads());
|
||||||
|
config.setNettyThreads(redissonConfig.getNettyThreads());
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.orion.ops.framework.redis.core.config;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* redisson 配置
|
||||||
|
*
|
||||||
|
* @author Jiahang Li
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2024/3/27 15:17
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ConfigurationProperties("spring.redisson")
|
||||||
|
public class RedissonConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务线程数
|
||||||
|
*/
|
||||||
|
private Integer threads;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* netty 线程数
|
||||||
|
*/
|
||||||
|
private Integer nettyThreads;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"groups": [
|
||||||
|
{
|
||||||
|
"name": "spring.redisson",
|
||||||
|
"type": "com.orion.ops.framework.redis.core.config.RedissonConfig",
|
||||||
|
"sourceType": "com.orion.ops.framework.redis.core.config.RedissonConfig"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "spring.redisson.threads",
|
||||||
|
"type": "java.lang.Integer",
|
||||||
|
"description": "任务线程数."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "spring.redisson.netty-threads",
|
||||||
|
"type": "java.lang.Integer",
|
||||||
|
"description": "netty 线程数."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -17,6 +17,11 @@
|
|||||||
"type": "java.lang.String",
|
"type": "java.lang.String",
|
||||||
"description": "swagger 项目描述."
|
"description": "swagger 项目描述."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "orion.swagger.author",
|
||||||
|
"type": "java.lang.String",
|
||||||
|
"description": "swagger 项目作者."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "orion.swagger.version",
|
"name": "orion.swagger.version",
|
||||||
"type": "java.lang.String",
|
"type": "java.lang.String",
|
||||||
|
|||||||
@@ -10,7 +10,10 @@ spring:
|
|||||||
redis:
|
redis:
|
||||||
host: 127.0.0.1
|
host: 127.0.0.1
|
||||||
port: 6379
|
port: 6379
|
||||||
password: lijiahang
|
password: Data@123456
|
||||||
|
redisson:
|
||||||
|
threads: 2
|
||||||
|
netty-threads: 2
|
||||||
|
|
||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
configuration:
|
configuration:
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ spring:
|
|||||||
host: ${REDIS_HOST:127.0.0.1}
|
host: ${REDIS_HOST:127.0.0.1}
|
||||||
port: ${REDIS_PORT:6379}
|
port: ${REDIS_PORT:6379}
|
||||||
password: ${REDIS_PASSWORD:Data@123456}
|
password: ${REDIS_PASSWORD:Data@123456}
|
||||||
|
redisson:
|
||||||
|
threads: 4
|
||||||
|
netty-threads: 4
|
||||||
|
|
||||||
springdoc:
|
springdoc:
|
||||||
api-docs:
|
api-docs:
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ spring:
|
|||||||
class: org.quartz.simpl.SimpleThreadPool
|
class: org.quartz.simpl.SimpleThreadPool
|
||||||
threadCount: 10
|
threadCount: 10
|
||||||
threadPriority: 5
|
threadPriority: 5
|
||||||
|
threadNamePrefix: quartz-
|
||||||
threadsInheritContextClassLoaderOfInitializingThread: true
|
threadsInheritContextClassLoaderOfInitializingThread: true
|
||||||
boot:
|
boot:
|
||||||
admin:
|
admin:
|
||||||
|
|||||||
@@ -88,6 +88,12 @@
|
|||||||
<groupId>com.orion.ops</groupId>
|
<groupId>com.orion.ops</groupId>
|
||||||
<artifactId>orion-ops-spring-boot-starter-storage</artifactId>
|
<artifactId>orion-ops-spring-boot-starter-storage</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- job -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.orion.ops</groupId>
|
||||||
|
<artifactId>orion-ops-spring-boot-starter-job</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
Reference in New Issue
Block a user