examples-spring-redis-amq
25 строк · 731.0 Байт
1package com.tasks.cache.config
2
3import org.redisson.Redisson
4import org.redisson.api.RedissonClient
5import org.redisson.config.Config
6import org.springframework.beans.factory.annotation.Value
7import org.springframework.context.annotation.Bean
8import org.springframework.context.annotation.Configuration
9
10
11@Configuration
12class RedisSpringConfig {
13@Bean
14fun redissonConfig(@Value("#{environment['redis.url']}") url: String): Config {
15var config = Config()
16config.useSingleServer().setAddress("redis://$url")
17//useClusterSetvers.addNodeAddress("redis://$url")
18return config
19}
20
21@Bean
22fun redissonClient(config: Config): RedissonClient {
23return Redisson.create(config)
24}
25}