27 lines
987 B
Java
27 lines
987 B
Java
package com.tailbet.config;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
|
|
|
/**
|
|
* Redis配置
|
|
*/
|
|
@Configuration
|
|
public class RedisConfig {
|
|
|
|
@Bean
|
|
public StringRedisTemplate stringRedisTemplate(RedisConnectionFactory connectionFactory) {
|
|
StringRedisTemplate template = new StringRedisTemplate();
|
|
template.setConnectionFactory(connectionFactory);
|
|
template.setKeySerializer(new StringRedisSerializer());
|
|
template.setValueSerializer(new StringRedisSerializer());
|
|
template.setHashKeySerializer(new StringRedisSerializer());
|
|
template.setHashValueSerializer(new StringRedisSerializer());
|
|
template.afterPropertiesSet();
|
|
return template;
|
|
}
|
|
}
|