Created
July 9, 2020 12:12
-
-
Save gauravat16/f4d19c67158f17cd11c4ca969758242f to your computer and use it in GitHub Desktop.
Redisson Beans
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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