zoukankan      html  css  js  c++  java
  • 生产redis client 连接无法释放

    原因是spring配置文件,开启了事务导致的,redis是缓存用的,不需要开启事务,正确的配置如下:

    <!--redis操作模版,使用该对象可以操作redis  -->  
        <bean id="redisTemplateTax" class="org.springframework.data.redis.core.RedisTemplate" >    
            <property name="connectionFactory" ref="connectionFactoryTax" />    
            <!--如果不配置Serializer,那么存储的时候缺省使用String,如果用User类型存储,那么会提示错误User can't cast to String!!  -->    
            <property name="keySerializer" >    
                <bean class="org.springframework.data.redis.serializer.StringRedisSerializer" />    
            </property>    
            <property name="valueSerializer" >    
                <bean class="org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer" />    
            </property>    
            <property name="hashKeySerializer">    
                <bean class="org.springframework.data.redis.serializer.StringRedisSerializer"/>    
            </property>    
            <property name="hashValueSerializer">    
                <bean class="org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer"/>    
            </property>    
            <!--开启事务  -->  
            <property name="enableTransactionSupport" value="false"></property>  
        </bean >   
    

      

  • 相关阅读:
    MySQL 安装
    MySQL简介
    图解十大经典的机器学习算法
    基于Python预测股价
    10_通过httprequest获取跟请求相关的信息
    07_参数提交时action的写法
    08_ServletConfig介绍
    05_servlet生命周期介绍
    06_url_pattern三种写法
    03_servletHello完成
  • 原文地址:https://www.cnblogs.com/wuhaidong/p/10313003.html
Copyright © 2011-2022 走看看