JedisConfig.java 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. //package com.usky.config.redis;
  2. //
  3. //
  4. //import com.usky.utils.jwt.common.StringUtil;
  5. //import org.slf4j.Logger;
  6. //import org.slf4j.LoggerFactory;
  7. //import org.springframework.beans.factory.annotation.Value;
  8. //import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
  9. //import org.springframework.boot.context.properties.ConfigurationProperties;
  10. //import org.springframework.context.annotation.Bean;
  11. //import org.springframework.context.annotation.Configuration;
  12. //import org.springframework.context.annotation.PropertySource;
  13. //import redis.clients.jedis.JedisPool;
  14. //import redis.clients.jedis.JedisPoolConfig;
  15. //
  16. ///**
  17. // * Jedis配置,项目启动注入JedisPool
  18. // * http://www.cnblogs.com/GodHeng/p/9301330.html
  19. // * @author laowo
  20. // * @date 2020/9/5 10:35
  21. // */
  22. //@Configuration
  23. //@EnableAutoConfiguration
  24. //@PropertySource("classpath:config.properties")
  25. //@ConfigurationProperties(prefix = "redis")
  26. //public class JedisConfig {
  27. //
  28. // /**
  29. // * logger
  30. // */
  31. // private static final Logger logger = LoggerFactory.getLogger(JedisConfig.class);
  32. //
  33. // private String host;
  34. //
  35. // private int port;
  36. //
  37. // private String password;
  38. //
  39. // private int timeout;
  40. //
  41. // @Value("${redis.pool.max-active}")
  42. // private int maxActive;
  43. //
  44. // @Value("${redis.pool.max-wait}")
  45. // private int maxWait;
  46. //
  47. // @Value("${redis.pool.max-idle}")
  48. // private int maxIdle;
  49. //
  50. // @Value("${redis.pool.min-idle}")
  51. // private int minIdle;
  52. //
  53. // @Bean
  54. // public JedisPool redisPoolFactory() {
  55. // try {
  56. // JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
  57. // jedisPoolConfig.setMaxIdle(maxIdle);
  58. // jedisPoolConfig.setMaxWaitMillis(maxWait);
  59. // jedisPoolConfig.setMaxTotal(maxActive);
  60. // jedisPoolConfig.setMinIdle(minIdle);
  61. // // 密码为空设置为null
  62. // if (StringUtil.isBlank(password)) {
  63. // password = null;
  64. // }
  65. // JedisPool jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout, password);
  66. // logger.info("初始化Redis连接池JedisPool成功!地址: {}:{}", host, port);
  67. // return jedisPool;
  68. // } catch (Exception e) {
  69. // logger.error("初始化Redis连接池JedisPool异常:{}", e.getMessage());
  70. // }
  71. // return null;
  72. // }
  73. //
  74. // public String getHost() {
  75. // return host;
  76. // }
  77. //
  78. // public void setHost(String host) {
  79. // this.host = host;
  80. // }
  81. //
  82. // public int getPort() {
  83. // return port;
  84. // }
  85. //
  86. // public void setPort(int port) {
  87. // this.port = port;
  88. // }
  89. //
  90. // public String getPassword() {
  91. // return password;
  92. // }
  93. //
  94. // public void setPassword(String password) {
  95. // this.password = password;
  96. // }
  97. //
  98. // public int getTimeout() {
  99. // return timeout;
  100. // }
  101. //
  102. // public void setTimeout(int timeout) {
  103. // this.timeout = timeout;
  104. // }
  105. //
  106. // public int getMaxActive() {
  107. // return maxActive;
  108. // }
  109. //
  110. // public void setMaxActive(int maxActive) {
  111. // this.maxActive = maxActive;
  112. // }
  113. //
  114. // public int getMaxWait() {
  115. // return maxWait;
  116. // }
  117. //
  118. // public void setMaxWait(int maxWait) {
  119. // this.maxWait = maxWait;
  120. // }
  121. //
  122. // public int getMaxIdle() {
  123. // return maxIdle;
  124. // }
  125. //
  126. // public void setMaxIdle(int maxIdle) {
  127. // this.maxIdle = maxIdle;
  128. // }
  129. //
  130. // public int getMinIdle() {
  131. // return minIdle;
  132. // }
  133. //
  134. // public void setMinIdle(int minIdle) {
  135. // this.minIdle = minIdle;
  136. // }
  137. //}