All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.itxiaoer.commons.redis.RedisConfig Maven / Gradle / Ivy

There is a newer version: 2.3.4
Show newest version
package com.itxiaoer.commons.redis;

import com.itxiaoer.commons.redis.sentinel.RedisSentinelConfig;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;

/**
 * @author : liuyk
 */
@Configuration
@SuppressWarnings("all")
@ConditionalOnMissingBean(RedisSentinelConfig.class)
public class RedisConfig {

    @Bean
    JedisConnectionFactory jedisConnectionFactory() {
        return new JedisConnectionFactory();
    }

    @Bean
    public  RedisTemplate redisTemplate() {
        RedisTemplate template = new RedisTemplate<>();
        template.setConnectionFactory(jedisConnectionFactory());
        return template;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy