use of org.springframework.data.redis.core.RedisTemplate in project camel by apache.
the class RedisProducerIntegrationTest method createRegistry.
@Override
protected JndiRegistry createRegistry() throws Exception {
JndiRegistry registry = super.createRegistry();
redisTemplate = new RedisTemplate();
redisTemplate.setConnectionFactory(CONNECTION_FACTORY);
redisTemplate.afterPropertiesSet();
registry.bind("redisTemplate", redisTemplate);
return registry;
}
use of org.springframework.data.redis.core.RedisTemplate in project paascloud-master by paascloud.
the class RedisConfiguration method redisTemplate.
@Bean("redisTemplate")
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
RedisTemplate<String, Object> template = new RedisTemplate<>();
template.setConnectionFactory(factory);
Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(Object.class);
ObjectMapper om = new ObjectMapper();
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
jackson2JsonRedisSerializer.setObjectMapper(om);
template.setValueSerializer(jackson2JsonRedisSerializer);
template.setKeySerializer(stringRedisSerializer());
template.afterPropertiesSet();
return template;
}
Aggregations