Skip to content

Instantly share code, notes, and snippets.

@gauravat16
Created July 9, 2020 12:12
Show Gist options
  • Save gauravat16/f4d19c67158f17cd11c4ca969758242f to your computer and use it in GitHub Desktop.
Save gauravat16/f4d19c67158f17cd11c4ca969758242f to your computer and use it in GitHub Desktop.
Redisson Beans
package gaurav.examples.redis.bloomfilter.config;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class BeanConfig {
@Autowired
private RedissonConfig redissonConfig;
@Bean
public Config getConfig() {
Config config = new Config();
config.useSingleServer().setAddress(redissonConfig.getRedisUrl());
return config;
}
@Bean
public RedissonClient getRedisClient(Config config) {
return Redisson.create(config);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment