Java Code Examples for org.springframework.data.redis.connection.jedis.JedisConnectionFactory#setPassword()
The following examples show how to use
org.springframework.data.redis.connection.jedis.JedisConnectionFactory#setPassword() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RedisConfig.java From springBoot-study with Apache License 2.0 | 6 votes |
/** * 配置工厂 */ @Bean public JedisConnectionFactory JedisConnectionFactory(JedisPoolConfig jedisPoolConfig) { JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory(jedisPoolConfig); /* * 设置密码,如果为空,则不设置 * 可在 redis.conf 文件中设置: requirepass 密码 */ if (redispwd == null || redispwd.length() == 0) { jedisConnectionFactory.setPassword(redispwd); } jedisConnectionFactory.setHostName(host); jedisConnectionFactory.setPort(port); return jedisConnectionFactory; }
Example 2
Source File: RedisConfig.java From demo-project with MIT License | 6 votes |
@Bean public JedisConnectionFactory jedisConnectionFactory() { logger.info("jedisConnectionFactory:初始化了"); JedisPoolConfig config = new JedisPoolConfig(); config.setMaxIdle(maxIdle); config.setMinIdle(minIdle); config.setMaxWaitMillis(maxWaitMillis); config.setMaxTotal(maxActive); //链接耗尽时是否阻塞,默认true config.setBlockWhenExhausted(true); //是否启用pool的jmx管理功能,默认true config.setJmxEnabled(true); JedisConnectionFactory factory = new JedisConnectionFactory(); factory.setPoolConfig(config); factory.setHostName(host); factory.setPort(port); factory.setPassword(password); factory.setDatabase(database); factory.setTimeout(timeout); return factory; }
Example 3
Source File: RedisApplication.java From redis-admin with Apache License 2.0 | 6 votes |
protected void createRedisConnection(String name, String host, int port, String password) { JedisConnectionFactory connectionFactory = new JedisConnectionFactory(); connectionFactory.setHostName(host); connectionFactory.setPort(port); if(!StringUtils.isEmpty(password)) connectionFactory.setPassword(password); connectionFactory.afterPropertiesSet(); RedisTemplate redisTemplate = new MyStringRedisTemplate(); redisTemplate.setConnectionFactory(connectionFactory); redisTemplate.afterPropertiesSet(); RedisApplication.redisTemplatesMap.put(name, redisTemplate); Map<String, Object> redisServerMap = new HashMap<String, Object>(); redisServerMap.put("name", name); redisServerMap.put("host", host); redisServerMap.put("port", port); redisServerMap.put("password", password); RedisApplication.redisServerCache.add(redisServerMap); initRedisKeysCache(redisTemplate, name); RedisZtreeUtil.initRedisNavigateZtree(name); }
Example 4
Source File: RedisConfig.java From Project with Apache License 2.0 | 5 votes |
@Bean public RedisConnectionFactory redisCF() { JedisConnectionFactory factory = new JedisConnectionFactory(); factory.setHostName("192.168.198.129"); factory.setPassword("123456"); return factory; }
Example 5
Source File: CachingConfig2.java From Project with Apache License 2.0 | 5 votes |
@Bean public RedisConnectionFactory redisConnectionFactory() { JedisConnectionFactory connectionFactory = new JedisConnectionFactory(); connectionFactory.setHostName("192.168.198.129"); connectionFactory.setPassword("123456"); return connectionFactory; }
Example 6
Source File: RedisConfig.java From Resource with GNU General Public License v3.0 | 5 votes |
@Bean public RedisConnectionFactory redisConnectionFactory() { JedisPoolConfig jedisPoolConfig = new JedisPoolConfig(); JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory(); jedisConnectionFactory.setHostName(env.getProperty("redis.host").trim()); jedisConnectionFactory.setPort(Integer.parseInt(env.getProperty("redis.port").trim())); jedisConnectionFactory.setPassword(env.getProperty("redis.password").trim()); jedisConnectionFactory.setDatabase(Integer.parseInt(env.getProperty("redis.database").trim())); jedisConnectionFactory.setUsePool(true); jedisConnectionFactory.setPoolConfig(jedisPoolConfig); return jedisConnectionFactory; }
Example 7
Source File: CacheService.java From springboot-learn with MIT License | 5 votes |
/** * redis 数据库连接池 * * @return */ @Bean public JedisConnectionFactory redisConnectionFactory() { JedisConnectionFactory factory = new JedisConnectionFactory(); factory.setHostName(redisConn.getHost()); factory.setPort(redisConn.getPort()); factory.setPassword(redisConn.getPassword()); factory.setTimeout(redisConn.getTimeout()); // 设置连接超时时间 factory.setDatabase(redisConn.getDatabase()); return factory; }
Example 8
Source File: RedisConfiguration.java From java-platform with Apache License 2.0 | 5 votes |
@Bean public JedisConnectionFactory jedisConnectionFactory() { JedisConnectionFactory connectionFactory = new JedisConnectionFactory(jedisPoolConfig()); connectionFactory.setHostName(hostName); connectionFactory.setPort(Integer.parseInt(port)); connectionFactory.setPassword(password); return connectionFactory; }
Example 9
Source File: RedisConfiguration.java From expper with GNU General Public License v3.0 | 5 votes |
@Bean JedisConnectionFactory jedisConnectionFactory() { JedisConnectionFactory factory = new JedisConnectionFactory(); factory.setHostName(redisProperties.getHost()); factory.setPort(redisProperties.getPort()); factory.setPassword(redisProperties.getPassword()); factory.setUsePool(true); return factory; }
Example 10
Source File: RedisLocalConfig.java From bearchoke with Apache License 2.0 | 5 votes |
@Bean public RedisConnectionFactory redisConnectionFactory() throws Exception { JedisConnectionFactory jcf = new JedisConnectionFactory(); jcf.setHostName(environment.getProperty("redis.hostname")); jcf.setPassword(environment.getProperty("redis.password")); jcf.setPort(environment.getProperty("redis.port", Integer.class)); return jcf; }