首页>代码>基于springboot实现分布式开源bbs论坛系统,maven多模块搭建>/quark-admin/src/main/java/com/quark/admin/config/RedisConfig.java
package com.quark.admin.config;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

/**
 * Created by lhr on 17-8-1.
 */
@Configuration
@EnableCaching
public class RedisConfig extends CachingConfigurerSupport {
    @Value("${spring.redis.host}")
    private String host;

    @Value("${spring.redis.port}")
    private int port;

    @Value("${spring.redis.timeout}")
    private int timeout;



    @Value("${spring.redis.pool.max-idle}")
    private int maxIdle;

    @Value("${spring.redis.pool.max-wait}")
    private long maxWaitMillis;

    @Bean
    public JedisPool redisPoolFactory() {
        Logger.getLogger(getClass()).info("JedisPool注入成功!!");
        Logger.getLogger(getClass()).info("redis地址:" + host + ":" + port);
        JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
        jedisPoolConfig.setMaxIdle(maxIdle);
        jedisPoolConfig.setMaxWaitMillis(maxWaitMillis);

        JedisPool jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout);

        return jedisPool;
    }

}

最近下载更多
lovelyy  LV11 2024年2月1日
微笑刺客  LV21 2023年12月27日
liuyuheng  LV17 2023年11月15日
limin123  LV6 2023年6月11日
Antuz56  LV2 2023年6月6日
122933615  LV3 2023年4月26日
谢谢谢谢谢谢你  LV6 2022年8月25日
13043860zj  LV16 2022年7月11日
molu123456 2022年7月7日
暂无贡献等级
李涛11111  LV8 2022年6月16日
最近浏览更多
ChanLain  LV2 3月3日
Duangi  LV1 2024年12月23日
charleswang  LV7 2024年10月21日
Boss绝  LV9 2024年5月19日
zuorishu 2024年5月16日
暂无贡献等级
来一杯西瓜冰咩  LV6 2024年5月13日
玖零定制问题修复  LV34 2024年5月4日
tianran9 2024年4月27日
暂无贡献等级
autonomy  LV1 2024年4月23日
zolscy  LV24 2024年4月23日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友