| | |
| | | package com.ruoyi.framework.config; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.ruoyi.common.utils.JsonUtils; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.config.properties.RedissonProperties; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | @Autowired |
| | | private RedissonProperties redissonProperties; |
| | | |
| | | @Autowired |
| | | private ObjectMapper objectMapper; |
| | | |
| | | @Primary |
| | | @Bean(destroyMethod = "shutdown") |
| | | public RedissonClient redisson() { |
| | | public RedissonClient redisson(RedisProperties redisProperties, RedissonProperties redissonProperties, ObjectMapper objectMapper) { |
| | | String prefix = REDIS_PROTOCOL_PREFIX; |
| | | if (redisProperties.isSsl()) { |
| | | prefix = REDISS_PROTOCOL_PREFIX; |
| | |
| | | Config config = new Config(); |
| | | config.setThreads(redissonProperties.getThreads()) |
| | | .setNettyThreads(redissonProperties.getNettyThreads()) |
| | | .setCodec(new JsonJacksonCodec(JsonUtils.getObjectMapper())); |
| | | .setCodec(new JsonJacksonCodec(objectMapper)); |
| | | |
| | | RedissonProperties.SingleServerConfig singleServerConfig = redissonProperties.getSingleServerConfig(); |
| | | if (ObjectUtil.isNotNull(singleServerConfig)) { |
| | |
| | | cacheConfig.setMaxSize(group.getMaxSize()); |
| | | config.put(group.getGroupId(), cacheConfig); |
| | | } |
| | | return new RedissonSpringCacheManager(redissonClient, config, JsonJacksonCodec.INSTANCE); |
| | | return new RedissonSpringCacheManager(redissonClient, config, new JsonJacksonCodec(objectMapper)); |
| | | } |
| | | |
| | | /** |