一.配置文件
spring: redis: host: 192.168.0.200 port: 6379 password: database: 1 pool.max-active: 8 pool.max-wait: -1 pool.max-idle: 8 pool.min-idle: 0 timeout: 5000
二.坐标
<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies>
三.redis消息监听器容器以及redis监听器注入IOC容器
package com.example.demo; import org.springfra