123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- //package com.usky.config.redis;
- //
- //
- //import com.usky.utils.jwt.common.StringUtil;
- //import org.slf4j.Logger;
- //import org.slf4j.LoggerFactory;
- //import org.springframework.beans.factory.annotation.Value;
- //import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
- //import org.springframework.boot.context.properties.ConfigurationProperties;
- //import org.springframework.context.annotation.Bean;
- //import org.springframework.context.annotation.Configuration;
- //import org.springframework.context.annotation.PropertySource;
- //import redis.clients.jedis.JedisPool;
- //import redis.clients.jedis.JedisPoolConfig;
- //
- ///**
- // * Jedis配置,项目启动注入JedisPool
- // * http://www.cnblogs.com/GodHeng/p/9301330.html
- // * @author laowo
- // * @date 2020/9/5 10:35
- // */
- //@Configuration
- //@EnableAutoConfiguration
- //@PropertySource("classpath:config.properties")
- //@ConfigurationProperties(prefix = "redis")
- //public class JedisConfig {
- //
- // /**
- // * logger
- // */
- // private static final Logger logger = LoggerFactory.getLogger(JedisConfig.class);
- //
- // private String host;
- //
- // private int port;
- //
- // private String password;
- //
- // private int timeout;
- //
- // @Value("${redis.pool.max-active}")
- // private int maxActive;
- //
- // @Value("${redis.pool.max-wait}")
- // private int maxWait;
- //
- // @Value("${redis.pool.max-idle}")
- // private int maxIdle;
- //
- // @Value("${redis.pool.min-idle}")
- // private int minIdle;
- //
- // @Bean
- // public JedisPool redisPoolFactory() {
- // try {
- // JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
- // jedisPoolConfig.setMaxIdle(maxIdle);
- // jedisPoolConfig.setMaxWaitMillis(maxWait);
- // jedisPoolConfig.setMaxTotal(maxActive);
- // jedisPoolConfig.setMinIdle(minIdle);
- // // 密码为空设置为null
- // if (StringUtil.isBlank(password)) {
- // password = null;
- // }
- // JedisPool jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout, password);
- // logger.info("初始化Redis连接池JedisPool成功!地址: {}:{}", host, port);
- // return jedisPool;
- // } catch (Exception e) {
- // logger.error("初始化Redis连接池JedisPool异常:{}", e.getMessage());
- // }
- // return null;
- // }
- //
- // public String getHost() {
- // return host;
- // }
- //
- // public void setHost(String host) {
- // this.host = host;
- // }
- //
- // public int getPort() {
- // return port;
- // }
- //
- // public void setPort(int port) {
- // this.port = port;
- // }
- //
- // public String getPassword() {
- // return password;
- // }
- //
- // public void setPassword(String password) {
- // this.password = password;
- // }
- //
- // public int getTimeout() {
- // return timeout;
- // }
- //
- // public void setTimeout(int timeout) {
- // this.timeout = timeout;
- // }
- //
- // public int getMaxActive() {
- // return maxActive;
- // }
- //
- // public void setMaxActive(int maxActive) {
- // this.maxActive = maxActive;
- // }
- //
- // public int getMaxWait() {
- // return maxWait;
- // }
- //
- // public void setMaxWait(int maxWait) {
- // this.maxWait = maxWait;
- // }
- //
- // public int getMaxIdle() {
- // return maxIdle;
- // }
- //
- // public void setMaxIdle(int maxIdle) {
- // this.maxIdle = maxIdle;
- // }
- //
- // public int getMinIdle() {
- // return minIdle;
- // }
- //
- // public void setMinIdle(int minIdle) {
- // this.minIdle = minIdle;
- // }
- //}
|