Skip to content

Commit

Permalink
Add support for password on a redis connection (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
JargoonPard authored and Matt Duftler committed May 11, 2016
1 parent 1b59b6d commit bd35b4a
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ import redis.clients.jedis.JedisPool
class JedisConfig {

@Bean
JedisPool jedisPool(@Value('${redis.connection:redis://localhost:6379}') String connection) {
JedisPool jedisPool(@Value('${redis.connection:redis://localhost:6379}') String connection,
@Value('${redis.timeout:2000}') int timeout) {
RedisConnectionInfo connectionInfo = RedisConnectionInfo.parseConnectionUri(connection)
GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig()
poolConfig.setMaxTotal(100)
poolConfig.setMinIdle(25)
poolConfig.setMaxIdle(100)
new JedisPool(poolConfig, connectionInfo.host, connectionInfo.port)
new JedisPool(poolConfig, connectionInfo.host, connectionInfo.port, timeout, connectionInfo.password)
}

@Bean
Expand Down

0 comments on commit bd35b4a

Please sign in to comment.