-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting default serializer does not override template default serializer for redis #691
Comments
If you use See |
I do override it. My whole config file:
|
@Glapa sorry for the late follow up on this. You shouldn't need to manually register You should reduce your configuration to something like this (based on your example): @Configuration
@EnableRedisHttpSession
public class Redis {
private final Environment env;
@Autowired
public Redis(Environment env) {
this.env = env;
}
@Bean
JedisConnectionFactory connectionFactory() {
JedisConnectionFactory factory = new JedisConnectionFactory();
factory.setHostName(env.getProperty("redis.hostName", "localhost"));
factory.setPort(Integer.parseInt(env.getProperty("redis.port", "1234")));
factory.setUsePool(true);
return factory;
}
@Bean
RedisTemplate<String, Object> redisTemplate() {
final RedisTemplate<String, Object> template = new RedisTemplate<>();
template.setConnectionFactory(connectionFactory());
template.setKeySerializer(new StringRedisSerializer());
template.setHashValueSerializer(new GenericToStringSerializer<>( Object.class ));
template.setValueSerializer(new GenericToStringSerializer<>( Object.class ));
return template;
}
@Bean
RedisSerializer<Object> springSessionDefaultRedisSerializer() {
return new CustomRedisSerializer();
}
} This will ensure that your |
Closing as answered. If you have additional questions or feel that your original question isn't properly answered, please re-open the issue. |
It requires explicit template creation as showed below:
As you can see I wan't to override only default serializer. It would be great to be able to do:
The text was updated successfully, but these errors were encountered: