Commit 5970f716 by QIANGLU

fix resouce 位置问题

parent f341fd43
...@@ -6,6 +6,7 @@ import org.springframework.context.annotation.Bean; ...@@ -6,6 +6,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer; import org.springframework.data.redis.serializer.StringRedisSerializer;
...@@ -18,15 +19,18 @@ import org.springframework.data.redis.serializer.StringRedisSerializer; ...@@ -18,15 +19,18 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
public class MatrixeRedisAutoConfiguration { public class MatrixeRedisAutoConfiguration {
@Bean @Bean
@ConditionalOnMissingBean(name = "redisTemplate") public RedisTemplate<String, String> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
public RedisTemplate<Object, Object> redisTemplate( RedisSerializer stringSerializer = new StringRedisSerializer();
RedisConnectionFactory redisConnectionFactory) { RedisTemplate<String, String> redisTemplate = new RedisTemplate();
RedisTemplate<Object, Object> template = new RedisTemplate<>(); redisTemplate.setConnectionFactory(redisConnectionFactory);
template.setConnectionFactory(redisConnectionFactory); redisTemplate.setKeySerializer(stringSerializer);
template.setDefaultSerializer(new StringRedisSerializer()); redisTemplate.setValueSerializer(stringSerializer);
return template; redisTemplate.setHashKeySerializer(stringSerializer);
redisTemplate.setHashValueSerializer(stringSerializer);
return redisTemplate;
} }
@Bean @Bean
@ConditionalOnMissingBean(MatrixRedisClusterUtils.class) @ConditionalOnMissingBean(MatrixRedisClusterUtils.class)
public MatrixRedisClusterUtils jedisClusterUtils() { public MatrixRedisClusterUtils jedisClusterUtils() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment