zoukankan      html  css  js  c++  java
  • spring配置redis

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">


    <bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
    <property name="maxTotal" value="300"/> <!-- 控制一个pool可分配多少个jedis实例 -->
    <property name="maxIdle" value="100" /> <!-- 控制一个pool最多有多少个状态为idle(空闲)的jedis实例 -->
    <property name="maxWaitMillis" value="2000" /> <!-- 表示当borrow一个jedis实例时,最大的等待时间,如果超过等待时间,则直接抛出JedisConnectionException -->
    <property name="testOnBorrow" value="true"/>
    <property name="testOnReturn" value="true"/>
    </bean>
    <!-- redis的连接池pool,不是必选项:timeout/password -->
    <bean id="jedisConnectionFactory"
    class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
    <property name="hostName" value="${redis.host}" />
    <property name="port" value="${redis.port}" />
    <property name="password" value="${redis.passWord}" />
    <property name="poolConfig" ref="jedisPoolConfig" />
    </bean>


    <bean id="stringRedisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">
    <property name="connectionFactory">
    <ref bean="jedisConnectionFactory" />
    </property>
    </bean>
    <!-- 配置springRedis -->
    <bean id="springRedis" class="com.inborn.inshop.common.redis.SpringRedis">
    <property name="redisKeyPrefix" value="${redis.key.prefix}" />
    <property name="stringRedisTemplate">
    <ref bean="stringRedisTemplate" />
    </property>
    </bean>

    </beans>

  • 相关阅读:
    第13篇-通过InterpreterCodelet存储机器指令片段
    第12篇-认识CodeletMark
    第11篇-认识Stub与StubQueue
    第10篇-初始化模板表
    第9篇-字节码指令的定义
    Java虚拟机漫漫学习路,我终于悟了
    Unity真机连接profiler
    提取图片中文字方法
    登录锁定个人收藏代码
    java判断密码是否为复杂类型(同时包含大小写和数字)
  • 原文地址:https://www.cnblogs.com/lvgg/p/6655359.html
Copyright © 2011-2022 走看看