springboot椤圭洰涓娇鐢╯pring-data-Redis瀵筸ap搴忓垪鍖栨椂鎶ラ敊

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了springboot椤圭洰涓娇鐢╯pring-data-Redis瀵筸ap搴忓垪鍖栨椂鎶ラ敊相关的知识,希望对你有一定的参考价值。

鏍囩锛?a href='http://www.mamicode.com/so/1/sch' title='sch'>sch   style   sock   tco   cut   adp   iss   col   handler   

閿欒淇℃伅锛?/p>

java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
    at org.springframework.data.redis.serializer.StringRedisSerializer.serialize(StringRedisSerializer.java:35)
    at org.springframework.data.redis.core.AbstractOperations.rawHashValue(AbstractOperations.java:184)
    at org.springframework.data.redis.core.DefaultHashOperations.put(DefaultHashOperations.java:175)
    at com.xxx.service.impl.CacheServiceImpl.setCacheMap(CacheServiceImpl.java:670)
    at com.xxx.service.impl.CacheServiceImpl.setCacheMap(CacheServiceImpl.java:683)
    at com.xxx.ws.StatusSocketClient.onMessage(StatusSocketClient.java:104)
    at sun.reflect.GeneratedMethodAccessor410.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:45005)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.tomcat.websocket.pojo.PojoMessageHandlerWholeBase.onMessage(PojoMessageHandlerWholeBase.java:80)
    at org.apache.tomcat.websocket.WsFrameBase.sendMessageText(WsFrameBase.java:394)
    at org.apache.tomcat.websocket.WsFrameBase.processDataText(WsFrameBase.java:495)
    at org.apache.tomcat.websocket.WsFrameBase.processData(WsFrameBase.java:294)
    at org.apache.tomcat.websocket.WsFrameBase.processInputBuffer(WsFrameBase.java:133)
    at org.apache.tomcat.websocket.WsFrameClient.processSocketRead(WsFrameClient.java:95)
    at org.apache.tomcat.websocket.WsFrameClient.resumeProcessing(WsFrameClient.java:209)
    at org.apache.tomcat.websocket.WsFrameClient.access$300(WsFrameClient.java:31)
    at org.apache.tomcat.websocket.WsFrameClient$WsFrameClientCompletionHandler.doResumeProcessing(WsFrameClient.java:186)
    at org.apache.tomcat.websocket.WsFrameClient$WsFrameClientCompletionHandler.completed(WsFrameClient.java:163)
    at org.apache.tomcat.websocket.WsFrameClient$WsFrameClientCompletionHandler.completed(WsFrameClient.java:148)
    at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126)
    at sun.nio.ch.Invoker$2.run(Invoker.java:218)
    at sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

鎵惧埌redis鐩稿叧閰嶇疆锛氬彂鐜癶ash鐨勯敭鍊煎簭鍒楀寲璁剧疆濡備笅

/*hash瀛楃涓插簭鍒楀寲鏂规硶*/
template.setHashKeySerializer(new StringRedisSerializer());
template.setHashValueSerializer(new StringRedisSerializer());

淇敼鍚庡涓?/p>

template.setHashValueSerializer(new JdkSerializationRedisSerializer());

鍙傝€冩潵婧愶細https://blog.csdn.net/qq_26525215/article/details/69367588

以上是关于springboot椤圭洰涓娇鐢╯pring-data-Redis瀵筸ap搴忓垪鍖栨椂鎶ラ敊的主要内容,如果未能解决你的问题,请参考以下文章

寮€婧愬伐鍏?| hbase-sdk ORM妗嗘灦

鐧藉珫鐗?2019Java寮€鍙戝叏缁堢瀹炴垬绉熸埧椤圭洰瑙嗛鏁欑▼

Vue + SpringBoot瀛︿範椤圭洰

鍩轰簬SpringBoot鎼缓涓€涓甫鏁版嵁搴撹闂殑WEB椤圭洰(璁板綍鎵€闇€鐨勪緷璧?閰嶇疆,椹卞姩瀹夎绛夋敞鎰忎簨椤?

甯︿綘浜嗚В椤圭洰绠$悊 | 椤圭洰绠$悊鍩虹鐭ヨ瘑