org.springframework.boot.autoconfigure.data.redis.RedisProperties#getPort ( )源码实例Demo

下面列出了org.springframework.boot.autoconfigure.data.redis.RedisProperties#getPort ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: ueboot   文件: RedisConfig.java
/**
 * spring boot 2.0后采用Lettuce作为redis调用客户端
 * 默认配置只支持单机模式,如需要其他模式,需要另外定义
 *
 * @return LettuceConnectionFactory
 */
@Bean
@ConditionalOnMissingBean(type = {"org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory"})
public LettuceConnectionFactory redisConnectionFactory(RedisProperties redisProperties) {
    RedisStandaloneConfiguration configuration = new RedisStandaloneConfiguration(redisProperties.getHost(),
            redisProperties.getPort());
    configuration.setDatabase(redisProperties.getDatabase());
    configuration.setPassword(RedisPassword.of(redisProperties.getPassword()));
    return new LettuceConnectionFactory(configuration);
}
 
源代码2 项目: spring-redis-websocket   文件: RedisConfig.java
@Bean
ReactiveRedisConnectionFactory reactiveRedisConnectionFactory(RedisProperties redisProperties) {
	RedisStandaloneConfiguration redisStandaloneConfiguration = new RedisStandaloneConfiguration(redisProperties.getHost(), redisProperties.getPort());
	redisStandaloneConfiguration.setPassword(redisProperties.getPassword());
	return new LettuceConnectionFactory(redisStandaloneConfiguration);
}