赞
踩
<!-- https://mvnrepository.com/artifact/redis.clients/jedis -->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</dependency>
@Configuration public class RedisConfig { //从配置文件中获取参数注入 @Value("${redis.host:127.0.0.1}") private String redisHost; @Value("${redis.port:6379}") private Integer redisPort; @Value("${redis.password}") private String redisPassword; //配置连接池 @Bean JedisPoolConfig jedisPoolConfig(){ JedisPoolConfig jedisPoolConfig = new JedisPoolConfig(); jedisPoolConfig.setMaxTotal(10); //最大连接数 jedisPoolConfig.setMaxIdle(10); //最大空闲连接数 return jedisPoolConfig; } //构造一个连接池对象 @Bean public JedisP
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。