Guest User

Untitled

a guest
Oct 18th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. @Bean(destroyMethod = "shutdown")
  2. RedissonClient redisson() throws Exception {
  3. URI uri = URI.create(redisUrl);
  4. Config config = new Config();
  5. final SingleServerConfig singleServerConfig = config.useSingleServer();
  6. singleServerConfig.setAddress(new URI(uri.getScheme(), null, uri.getHost(), uri.getPort(), null, null, null).toString());
  7. if (StringUtils.hasText(uri.getUserInfo())) {
  8. String password = uri.getUserInfo().split(":", 2)[1];
  9. singleServerConfig.setPassword(password);
  10. }
  11. return Redisson.create(config);
  12. }
Add Comment
Please, Sign In to add comment