You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
redisson/redisson-spring-boot-starter/README.md

120 lines
2.9 KiB
Markdown

# Spring Boot Starter
6 years ago
Integrates Redisson with Spring Boot library. Depends on [Spring Data Redis](https://github.com/redisson/redisson/tree/master/redisson-spring-data#spring-data-redis-integration) module.
2 years ago
Supports Spring Boot 1.3.x - 3.0.x
## Usage
### 1. Add `redisson-spring-boot-starter` dependency into your project:
6 years ago
Maven
6 years ago
```xml
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-boot-starter</artifactId>
2 years ago
<version>3.19.2</version>
</dependency>
6 years ago
```
6 years ago
Gradle
```groovy
2 years ago
compile 'org.redisson:redisson-spring-boot-starter:3.19.2'
```
5 years ago
5 years ago
Downgrade `redisson-spring-data` module if necessary to support required Spring Boot version:
5 years ago
5 years ago
|redisson-spring-data<br/>module name|Spring Boot<br/>version|
5 years ago
|----------------------------|-------------------|
3 years ago
|redisson-spring-data-16 |1.3.y |
|redisson-spring-data-17 |1.4.y |
|redisson-spring-data-18 |1.5.y |
|redisson-spring-data-2x |2.x.y |
2 years ago
|redisson-spring-data-3x |3.x.y |
5 years ago
7 years ago
### 2. Add settings into `application.settings` file
4 years ago
Using common spring boot settings:
6 years ago
```yaml
spring:
redis:
database:
host:
port:
password:
ssl:
timeout:
2 years ago
connectTimeout:
clientName:
cluster:
nodes:
sentinel:
master:
nodes:
4 years ago
```
2 years ago
Using Redisson config file:
4 years ago
```yaml
spring:
4 years ago
redis:
4 years ago
redisson:
4 years ago
file: classpath:redisson.yaml
2 years ago
```
Using Redisson settings:
```yaml
spring:
redis:
redisson:
4 years ago
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.Kryo5Codec> {}
4 years ago
transportMode: "NIO"
7 years ago
```
4 years ago
### 3. Available Spring Beans:
4 years ago
4 years ago
- `RedissonClient`
- `RedissonRxClient`
- `RedissonReactiveClient`
- `RedisTemplate`
- `ReactiveRedisTemplate`
4 years ago
3 years ago
Try __[Redisson PRO](https://redisson.pro)__ with **ultra-fast performance** and **support by SLA**.