From bf7ab3fe2ba246208d729901c33a9402209ee26a Mon Sep 17 00:00:00 2001 From: songww <songww@inspur.com> Date: 星期五, 08 五月 2020 21:57:07 +0800 Subject: [PATCH] 优化代码结构,提供NVR录像检索接口 --- src/main/java/com/genersoft/iot/vmp/conf/RedisConfig.java | 32 +++++--------------------------- 1 files changed, 5 insertions(+), 27 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/conf/RedisConfig.java b/src/main/java/com/genersoft/iot/vmp/conf/RedisConfig.java index 914d0c3..3448a2f 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/RedisConfig.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/RedisConfig.java @@ -12,20 +12,19 @@ import com.genersoft.iot.vmp.utils.redis.FastJsonRedisSerializer; /** - * @Description:Redis涓棿浠堕厤缃被 + * @Description:Redis涓棿浠堕厤缃被锛屼娇鐢╯pring-data-redis闆嗘垚锛岃嚜鍔ㄤ粠application.yml涓姞杞絩edis閰嶇疆 * @author: songww * @date: 2019骞�5鏈�30鏃� 涓婂崍10:58:25 * */ @Configuration -// @EnableCaching public class RedisConfig extends CachingConfigurerSupport { @Bean("redisTemplate") public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) { RedisTemplate<Object, Object> template = new RedisTemplate<>(); template.setConnectionFactory(redisConnectionFactory); - ParserConfig.getGlobalInstance().setAutoTypeSupport(true); + // 浣跨敤fastjson杩涜搴忓垪鍖栧鐞嗭紝鎻愰珮瑙f瀽鏁堢巼 FastJsonRedisSerializer<Object> serializer = new FastJsonRedisSerializer<Object>(Object.class); // value鍊肩殑搴忓垪鍖栭噰鐢╢astJsonRedisSerializer template.setValueSerializer(serializer); @@ -33,8 +32,9 @@ // key鐨勫簭鍒楀寲閲囩敤StringRedisSerializer template.setKeySerializer(new StringRedisSerializer()); template.setHashKeySerializer(new StringRedisSerializer()); - template.setConnectionFactory(redisConnectionFactory); + // 浣跨敤fastjson鏃堕渶璁剧疆姝ら」锛屽惁鍒欎細鎶ュ紓甯竛ot support type + ParserConfig.getGlobalInstance().setAutoTypeSupport(true); return template; } @@ -53,27 +53,5 @@ container.setConnectionFactory(connectionFactory); return container; } -// @Bean -// RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory, -// MessageListenerAdapter listenerAdapter) { -// -// RedisMessageListenerContainer container = new RedisMessageListenerContainer(); -// container.setConnectionFactory(connectionFactory); -// // 璁㈤槄浜嗕竴涓彨閫氶亾 -// container.addMessageListener(listenerAdapter, new PatternTopic(VideoManagerConstants.KEEPLIVEKEY_PREFIX+"*")); -// // 杩欎釜container 鍙互娣诲姞澶氫釜 messageListener -// return container; -// } - -// /** -// * 娑堟伅鐩戝惉鍣ㄩ�傞厤鍣紝缁戝畾娑堟伅澶勭悊鍣紝鍒╃敤鍙嶅皠鎶�鏈皟鐢ㄦ秷鎭鐞嗗櫒鐨勪笟鍔℃柟娉� -// * @param receiver -// * @return -// */ -// @Bean -// MessageListenerAdapter listenerAdapter(MessageReceiver receiver) { -// //杩欎釜鍦版柟 鏄粰messageListenerAdapter 浼犲叆涓�涓秷鎭帴鍙楃殑澶勭悊鍣紝鍒╃敤鍙嶅皠鐨勬柟娉曡皟鐢ㄢ�渞eceiveMessage鈥� -// //涔熸湁濂藉嚑涓噸杞芥柟娉曪紝杩欒竟榛樿璋冪敤澶勭悊鍣ㄧ殑鏂规硶 鍙玥andleMessage 鍙互鑷繁鍒版簮鐮侀噷闈㈢湅 -// return new MessageListenerAdapter(receiver, "receiveMessage"); -// } + } -- Gitblit v1.8.0