All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ermybatis.super-mybatis-cache-redis.1.1.9.source-code.applicationContext-supermybatis-cache-redis.xml Maven / Gradle / Ivy

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

    <!-- redis数据源 -->
    <bean id="poolConfig" class="com.cjxch.supermybatis.cache.redis.init.SuperMybatisJedisPoolConfig">
    </bean>

    <!-- Spring-redis连接池管理工厂 -->
    <bean id="jedisConnectionFactory" class="com.cjxch.supermybatis.cache.redis.init.SuperMybatisRedisConnectionFactory">
        <!-- 连接池配置引用 -->
        <property name="poolConfig" ref="poolConfig" />
        <!-- usePool:是否使用连接池 -->
        <property name="usePool" value="true"/>
    </bean>

    <!-- redis template definition -->
    <bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate">
        <property name="connectionFactory" ref="jedisConnectionFactory" />
        <property name="keySerializer">
            <bean class="org.springframework.data.redis.serializer.StringRedisSerializer" />
        </property>
        <property name="valueSerializer">
            <bean class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer" />
        </property>
        <property name="hashKeySerializer">
            <bean class="org.springframework.data.redis.serializer.StringRedisSerializer" />
        </property>
        <property name="hashValueSerializer">
            <bean class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer" />
        </property>
        <!--开启事务  -->
        <property name="enableTransactionSupport" value="true"></property>
    </bean>

    <!--自定义redis工具类,在需要缓存的地方注入此类  -->
    <bean id="redisService" class="com.cjxch.supermybatis.cache.redis.init.SuperMybatisRedisService">
        <property name="redisTemplate" ref="redisTemplate" />
    </bean>
</beans>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy