7

As the title says, was there a spring data redis mapping to the Redisson framework (http://redisson.org)

EvilJinious1
  • 2,773
  • 6
  • 43
  • 63

2 Answers2

8

Short answer

There is Spring Data Redis integration

Long answer

Consider Spring Data Redis integration as another type of connector or binding (check here for the connector term). The library provides RedissonConnectionFactory (implements RedisConnectionFactory) which would be the base for working with e.g. @RedisHash and spring cache abstraction (@EnableCaching). There's also a redisson-spring-boot-starter but make sure not to have lettuce or jedis in classpath because org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration (provided by spring-boot-autoconfigure) might create a RedisConnectionFactory before org.redisson.spring.starter.RedissonAutoConfiguration (provided by redisson-spring-boot-starter)!

Adrian
  • 3,321
  • 2
  • 29
  • 46
-1
  1. Add redisson-spring-boot-starter dependency into your project:

    compile 'org.redisson:redisson-spring-boot-starter:3.13.5'

  2. Add settings into application.settings file

common spring boot props:

spring:
      redis:
        database: 
        host:
        port:
        password:
        ssl: 
        timeout:
        cluster:
          nodes:
        sentinel:
          master:
          nodes:
    
        
      redisson: 
        file: classpath:redisson.yaml
        config: |
          clusterServersConfig:
            idleConnectionTimeout: 10000
            connectTimeout: 10000
            timeout: 3000
            retryAttempts: 3
            retryInterval: 1500
            failedSlaveReconnectionInterval: 3000
            failedSlaveCheckInterval: 60000
            password: null
            subscriptionsPerConnection: 5
            clientName: null
            loadBalancer: !<org.redisson.connection.balancer.RoundRobinLoadBalancer> {}
            subscriptionConnectionMinimumIdleSize: 1
            subscriptionConnectionPoolSize: 50
            slaveConnectionMinimumIdleSize: 24
            slaveConnectionPoolSize: 64
            masterConnectionMinimumIdleSize: 24
            masterConnectionPoolSize: 64
            readMode: "SLAVE"
            subscriptionMode: "SLAVE"
            nodeAddresses:
            - "redis://127.0.0.1:7004"
            - "redis://127.0.0.1:7001"
            - "redis://127.0.0.1:7000"
            scanInterval: 1000
            pingConnectionInterval: 0
            keepAlive: false
            tcpNoDelay: false
          threads: 16
          nettyThreads: 32
          codec: !<org.redisson.codec.FstCodec> {}
          transportMode: "NIO"

3.Use Redisson through spring bean with RedissonClient interface or RedisTemplate/ReactiveRedisTemplate objects

gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
  • 2
    I am still trying to think how this answer is helpful. Copy-paste from https://github.com/redisson/redisson/tree/master/redisson-spring-boot-starter but does not answer even part of the question. – shankulk Jan 31 '23 at 22:55
  • 1
    Agreed this is a blatant copy paste with no effort. – Mark Feb 19 '23 at 18:04