From c6c9b7d3baa822765768c110304d27623f946286 Mon Sep 17 00:00:00 2001
From: pjb <123456>
Date: 星期二, 15 七月 2025 14:29:09 +0800
Subject: [PATCH] `1`
---
zy-asrs-wms/src/main/java/com/zy/asrs/wms/common/config/RedisConfig.java | 196 ++++++++++++++++++++++++------------------------
1 files changed, 98 insertions(+), 98 deletions(-)
diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/common/config/RedisConfig.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/common/config/RedisConfig.java
index b75e59e..b2d529b 100644
--- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/common/config/RedisConfig.java
+++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/common/config/RedisConfig.java
@@ -1,98 +1,98 @@
-package com.zy.asrs.wms.common.config;
-
-import com.fasterxml.jackson.annotation.JsonAutoDetect;
-import com.fasterxml.jackson.annotation.PropertyAccessor;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.springframework.cache.annotation.CachingConfigurerSupport;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.data.redis.connection.RedisConnectionFactory;
-import org.springframework.data.redis.core.*;
-import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
-import org.springframework.data.redis.serializer.StringRedisSerializer;
-
-/**
- * Redis閰嶇疆绫�
- * Created by vincent on 2019-12-23
- */
-@Configuration
-//@EnableCaching // 寮�鍚暟鎹紦瀛樻満鍒�
-public class RedisConfig extends CachingConfigurerSupport {
-
-
- /**
- * RedisTemplate鐩稿叧閰嶇疆
- */
- @Bean
- public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
-
- RedisTemplate<String, Object> template = new RedisTemplate<>();
- // 閰嶇疆杩炴帴宸ュ巶
- template.setConnectionFactory(factory);
-
- //浣跨敤Jackson2JsonRedisSerializer鏉ュ簭鍒楀寲鍜屽弽搴忓垪鍖杛edis鐨剉alue鍊硷紙榛樿浣跨敤JDK鐨勫簭鍒楀寲鏂瑰紡锛�
- Jackson2JsonRedisSerializer<Object> jacksonSerializer = new Jackson2JsonRedisSerializer<>(Object.class);
-
- ObjectMapper om = new ObjectMapper();
- // 鎸囧畾瑕佸簭鍒楀寲鐨勫煙锛宖ield,get鍜宻et,浠ュ強淇グ绗﹁寖鍥达紝ANY鏄兘鏈夊寘鎷琾rivate鍜宲ublic
- om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
- // 鎸囧畾搴忓垪鍖栬緭鍏ョ殑绫诲瀷锛岀被蹇呴』鏄潪final淇グ鐨勶紝final淇グ鐨勭被锛屾瘮濡係tring,Integer绛変細璺戝嚭寮傚父
- om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
- jacksonSerializer.setObjectMapper(om);
-
- // 鍊奸噰鐢╦son搴忓垪鍖�
- template.setValueSerializer(jacksonSerializer);
- //浣跨敤StringRedisSerializer鏉ュ簭鍒楀寲鍜屽弽搴忓垪鍖杛edis鐨刱ey鍊�
- template.setKeySerializer(new StringRedisSerializer());
-
- // 璁剧疆hash key 鍜寁alue搴忓垪鍖栨ā寮�
- template.setHashKeySerializer(new StringRedisSerializer());
- template.setHashValueSerializer(jacksonSerializer);
- template.afterPropertiesSet();
-
- return template;
- }
-
-
- /**
- * 瀵箁edis瀛楃涓茬被鍨嬫暟鎹搷浣�
- */
- @Bean
- public ValueOperations<String, Object> valueOperations(RedisTemplate<String, Object> redisTemplate) {
- return redisTemplate.opsForValue();
- }
-
- /**
- * 瀵筯ash绫诲瀷鐨勬暟鎹搷浣�
- */
- @Bean
- public HashOperations<String, String, Object> hashOperations(RedisTemplate<String, Object> redisTemplate) {
- return redisTemplate.opsForHash();
- }
-
- /**
- * 瀵归摼琛ㄧ被鍨嬬殑鏁版嵁鎿嶄綔
- */
- @Bean
- public ListOperations<String, Object> listOperations(RedisTemplate<String, Object> redisTemplate) {
- return redisTemplate.opsForList();
- }
-
- /**
- * 瀵规棤搴忛泦鍚堢被鍨嬬殑鏁版嵁鎿嶄綔
- */
- @Bean
- public SetOperations<String, Object> setOperations(RedisTemplate<String, Object> redisTemplate) {
- return redisTemplate.opsForSet();
- }
-
- /**
- * 瀵规湁搴忛泦鍚堢被鍨嬬殑鏁版嵁鎿嶄綔
- */
- @Bean
- public ZSetOperations<String, Object> zSetOperations(RedisTemplate<String, Object> redisTemplate) {
- return redisTemplate.opsForZSet();
- }
-
-
-}
+package com.zy.asrs.wms.common.config;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.PropertyAccessor;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.cache.annotation.CachingConfigurerSupport;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.core.*;
+import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+
+/**
+ * Redis閰嶇疆绫�
+ * Created by vincent on 2019-12-23
+ */
+@Configuration
+//@EnableCaching // 寮�鍚暟鎹紦瀛樻満鍒�
+public class RedisConfig extends CachingConfigurerSupport {
+
+
+ /**
+ * RedisTemplate鐩稿叧閰嶇疆
+ */
+ @Bean
+ public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
+
+ RedisTemplate<String, Object> template = new RedisTemplate<>();
+ // 閰嶇疆杩炴帴宸ュ巶
+ template.setConnectionFactory(factory);
+
+ //浣跨敤Jackson2JsonRedisSerializer鏉ュ簭鍒楀寲鍜屽弽搴忓垪鍖杛edis鐨剉alue鍊硷紙榛樿浣跨敤JDK鐨勫簭鍒楀寲鏂瑰紡锛�
+ Jackson2JsonRedisSerializer<Object> jacksonSerializer = new Jackson2JsonRedisSerializer<>(Object.class);
+
+ ObjectMapper om = new ObjectMapper();
+ // 鎸囧畾瑕佸簭鍒楀寲鐨勫煙锛宖ield,get鍜宻et,浠ュ強淇グ绗﹁寖鍥达紝ANY鏄兘鏈夊寘鎷琾rivate鍜宲ublic
+ om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
+ // 鎸囧畾搴忓垪鍖栬緭鍏ョ殑绫诲瀷锛岀被蹇呴』鏄潪final淇グ鐨勶紝final淇グ鐨勭被锛屾瘮濡係tring,Integer绛変細璺戝嚭寮傚父
+ om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
+ jacksonSerializer.setObjectMapper(om);
+
+ // 鍊奸噰鐢╦son搴忓垪鍖�
+ template.setValueSerializer(jacksonSerializer);
+ //浣跨敤StringRedisSerializer鏉ュ簭鍒楀寲鍜屽弽搴忓垪鍖杛edis鐨刱ey鍊�
+ template.setKeySerializer(new StringRedisSerializer());
+
+ // 璁剧疆hash key 鍜寁alue搴忓垪鍖栨ā寮�
+ template.setHashKeySerializer(new StringRedisSerializer());
+ template.setHashValueSerializer(jacksonSerializer);
+ template.afterPropertiesSet();
+
+ return template;
+ }
+
+
+ /**
+ * 瀵箁edis瀛楃涓茬被鍨嬫暟鎹搷浣�
+ */
+ @Bean
+ public ValueOperations<String, Object> valueOperations(RedisTemplate<String, Object> redisTemplate) {
+ return redisTemplate.opsForValue();
+ }
+
+ /**
+ * 瀵筯ash绫诲瀷鐨勬暟鎹搷浣�
+ */
+ @Bean
+ public HashOperations<String, String, Object> hashOperations(RedisTemplate<String, Object> redisTemplate) {
+ return redisTemplate.opsForHash();
+ }
+
+ /**
+ * 瀵归摼琛ㄧ被鍨嬬殑鏁版嵁鎿嶄綔
+ */
+ @Bean
+ public ListOperations<String, Object> listOperations(RedisTemplate<String, Object> redisTemplate) {
+ return redisTemplate.opsForList();
+ }
+
+ /**
+ * 瀵规棤搴忛泦鍚堢被鍨嬬殑鏁版嵁鎿嶄綔
+ */
+ @Bean
+ public SetOperations<String, Object> setOperations(RedisTemplate<String, Object> redisTemplate) {
+ return redisTemplate.opsForSet();
+ }
+
+ /**
+ * 瀵规湁搴忛泦鍚堢被鍨嬬殑鏁版嵁鎿嶄綔
+ */
+ @Bean
+ public ZSetOperations<String, Object> zSetOperations(RedisTemplate<String, Object> redisTemplate) {
+ return redisTemplate.opsForZSet();
+ }
+
+
+}
--
Gitblit v1.9.1